Ciphertext class

The KMS ciphertext resource allows you to encrypt plaintext into ciphertext by using an AWS KMS customer master key. The value returned by this resource is stable across every apply. For a changing ciphertext value each apply, see the aws.kms.Ciphertext data source.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const oauthConfig = new aws.kms.Key("oauth_config", {
    description: "oauth config",
    isEnabled: true,
});
const oauth = new aws.kms.Ciphertext("oauth", {
    keyId: oauthConfig.keyId,
    plaintext: `{
  \\"client_id\\": \\"e587dbae22222f55da22\\",
  \\"client_secret\\": \\"8289575d00000ace55e1815ec13673955721b8a5\\"
}
`,
});
import pulumi
import pulumi_aws as aws

oauth_config = aws.kms.Key("oauth_config",
    description="oauth config",
    is_enabled=True)
oauth = aws.kms.Ciphertext("oauth",
    key_id=oauth_config.key_id,
    plaintext="""{
  \"client_id\": \"e587dbae22222f55da22\",
  \"client_secret\": \"8289575d00000ace55e1815ec13673955721b8a5\"
}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var oauthConfig = new Aws.Kms.Key("oauth_config", new()
    {
        Description = "oauth config",
        IsEnabled = true,
    });

    var oauth = new Aws.Kms.Ciphertext("oauth", new()
    {
        KeyId = oauthConfig.KeyId,
        Plaintext = @"{
  \""client_id\"": \""e587dbae22222f55da22\"",
  \""client_secret\"": \""8289575d00000ace55e1815ec13673955721b8a5\""
}
",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		oauthConfig, err := kms.NewKey(ctx, "oauth_config", &kms.KeyArgs{
			Description: pulumi.String("oauth config"),
			IsEnabled:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = kms.NewCiphertext(ctx, "oauth", &kms.CiphertextArgs{
			KeyId:     oauthConfig.KeyId,
			Plaintext: pulumi.String("{\n  \\\"client_id\\\": \\\"e587dbae22222f55da22\\\",\n  \\\"client_secret\\\": \\\"8289575d00000ace55e1815ec13673955721b8a5\\\"\n}\n"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_kms_key" "oauth_config" {
  description = "oauth config"
  is_enabled  = true
}
resource "aws_kms_ciphertext" "oauth" {
  key_id    = aws_kms_key.oauth_config.key_id
  plaintext = "{\n  \\\"client_id\\\": \\\"e587dbae22222f55da22\\\",\n  \\\"client_secret\\\": \\\"8289575d00000ace55e1815ec13673955721b8a5\\\"\n}\n"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.kms.Ciphertext;
import com.pulumi.aws.kms.CiphertextArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var oauthConfig = new Key("oauthConfig", KeyArgs.builder()
            .description("oauth config")
            .isEnabled(true)
            .build());

        var oauth = new Ciphertext("oauth", CiphertextArgs.builder()
            .keyId(oauthConfig.keyId())
            .plaintext("""
{
  \"client_id\": \"e587dbae22222f55da22\",
  \"client_secret\": \"8289575d00000ace55e1815ec13673955721b8a5\"
}
            """)
            .build());

    }
}
resources:
  oauthConfig:
    type: aws:kms:Key
    name: oauth_config
    properties:
      description: oauth config
      isEnabled: true
  oauth:
    type: aws:kms:Ciphertext
    properties:
      keyId: ${oauthConfig.keyId}
      plaintext: |
        {
          \"client_id\": \"e587dbae22222f55da22\",
          \"client_secret\": \"8289575d00000ace55e1815ec13673955721b8a5\"
        }

Constructors

Ciphertext(String name, {CiphertextArgs? args, CustomResourceOptions? options})
Creates a new Ciphertext. name The Pulumi resource name. args Arguments used to configure this Ciphertext. The set of arguments for Ciphertext. options Resource options controlling this resource's behavior.
Ciphertext.reference(String urn)
Creates a typed reference to an existing Ciphertext resource.

Properties

childResources → Set<Resource>
finalinherited
ciphertextBlob ↔ Output<String>
Base64 encoded ciphertext
latefinal
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
context ↔ Output<Map<String, String>?>
An optional mapping that makes up the encryption context.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
keyId ↔ Output<String>
Globally unique key ID for the customer master key.
latefinal
plaintext ↔ Output<String?>
Data to be encrypted. Note that this may show up in logs, and it will be stored in the state file.
latefinal
plaintextWo ↔ Output<String?>
NOTE: This field is write-only and its value will not be updated in state as part of read operations. Data to be encrypted. Note that this may show up in logs. It will not be stored in the state file.
latefinal
plaintextWoVersion ↔ Output<String?>
Used together with plaintextWo to trigger a replacement. Modify this value when a replacement is required.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {CiphertextState? state, CustomResourceOptions? options}) → Ciphertext
Gets an existing Ciphertext resource's state with the given name and id.