GetCipherText

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

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var oauthConfig = new Aws.Kms.Key("oauthConfig", new Aws.Kms.KeyArgs
        {
            Description = "oauth config",
            IsEnabled = true,
        });
        var oauth = oauthConfig.KeyId.Apply(keyId => Aws.Kms.GetCipherText.InvokeAsync(new Aws.Kms.GetCipherTextArgs
        {
            KeyId = keyId,
            Plaintext = @"{
  ""client_id"": ""e587dbae22222f55da22"",
  ""client_secret"": ""8289575d00000ace55e1815ec13673955721b8a5""
}

",
        }));
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/kms"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        oauthConfig, err := kms.NewKey(ctx, "oauthConfig", &kms.KeyArgs{
            Description: pulumi.String("oauth config"),
            IsEnabled:   pulumi.Bool(true),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

oauth_config = aws.kms.Key("oauthConfig",
    description="oauth config",
    is_enabled=True)
oauth = oauth_config.key_id.apply(lambda key_id: aws.kms.get_cipher_text(key_id=key_id,
    plaintext="""{
  "client_id": "e587dbae22222f55da22",
  "client_secret": "8289575d00000ace55e1815ec13673955721b8a5"
}

"""))
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 = oauthConfig.keyId.apply(keyId => aws.kms.getCipherText({
    keyId: keyId,
    plaintext: `{
  "client_id": "e587dbae22222f55da22",
  "client_secret": "8289575d00000ace55e1815ec13673955721b8a5"
}
`,
}, { async: true }));

Using GetCipherText

function getCipherText(args: GetCipherTextArgs, opts?: InvokeOptions): Promise<GetCipherTextResult>
function  get_cipher_text(context=None, key_id=None, plaintext=None, opts=None)
func GetCipherText(ctx *Context, args *GetCipherTextArgs, opts ...InvokeOption) (*GetCipherTextResult, error)
public static class GetCipherText {
    public static Task<GetCipherTextResult> InvokeAsync(GetCipherTextArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

KeyId string

Globally unique key ID for the customer master key.

Plaintext string

Data to be encrypted. Note that this may show up in logs, and it will be stored in the state file.

Context Dictionary<string, string>

An optional mapping that makes up the encryption context.

KeyId string

Globally unique key ID for the customer master key.

Plaintext string

Data to be encrypted. Note that this may show up in logs, and it will be stored in the state file.

Context map[string]string

An optional mapping that makes up the encryption context.

keyId string

Globally unique key ID for the customer master key.

plaintext string

Data to be encrypted. Note that this may show up in logs, and it will be stored in the state file.

context {[key: string]: string}

An optional mapping that makes up the encryption context.

key_id str

Globally unique key ID for the customer master key.

plaintext str

Data to be encrypted. Note that this may show up in logs, and it will be stored in the state file.

context Dict[str, str]

An optional mapping that makes up the encryption context.

GetCipherText Result

The following output properties are available:

CiphertextBlob string

Base64 encoded ciphertext

Id string

The provider-assigned unique ID for this managed resource.

KeyId string
Plaintext string
Context Dictionary<string, string>
CiphertextBlob string

Base64 encoded ciphertext

Id string

The provider-assigned unique ID for this managed resource.

KeyId string
Plaintext string
Context map[string]string
ciphertextBlob string

Base64 encoded ciphertext

id string

The provider-assigned unique ID for this managed resource.

keyId string
plaintext string
context {[key: string]: string}
ciphertext_blob str

Base64 encoded ciphertext

id str

The provider-assigned unique ID for this managed resource.

key_id str
plaintext str
context Dict[str, str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.