AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

Ciphertext

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

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 = new Aws.Kms.Ciphertext("oauth", new Aws.Kms.CiphertextArgs
        {
            KeyId = oauthConfig.KeyId,
            Plaintext = @"{
  ""client_id"": ""e587dbae22222f55da22"",
  ""client_secret"": ""8289575d00000ace55e1815ec13673955721b8a5""
}
",
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/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, "oauthConfig", &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(fmt.Sprintf("%v%v%v%v", "{\n", "  \"client_id\": \"e587dbae22222f55da22\",\n", "  \"client_secret\": \"8289575d00000ace55e1815ec13673955721b8a5\"\n", "}\n")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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());

    }
}
import pulumi
import pulumi_aws as aws

oauth_config = aws.kms.Key("oauthConfig",
    description="oauth config",
    is_enabled=True)
oauth = aws.kms.Ciphertext("oauth",
    key_id=oauth_config.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("oauthConfig", {
    description: "oauth config",
    isEnabled: true,
});
const oauth = new aws.kms.Ciphertext("oauth", {
    keyId: oauthConfig.keyId,
    plaintext: `{
  "client_id": "e587dbae22222f55da22",
  "client_secret": "8289575d00000ace55e1815ec13673955721b8a5"
}
`,
});
resources:
  oauthConfig:
    type: aws:kms:Key
    properties:
      description: oauth config
      isEnabled: true
  oauth:
    type: aws:kms:Ciphertext
    properties:
      keyId: ${oauthConfig.keyId}
      plaintext: |
        {
          "client_id": "e587dbae22222f55da22",
          "client_secret": "8289575d00000ace55e1815ec13673955721b8a5"
        }        

Create a Ciphertext Resource

new Ciphertext(name: string, args: CiphertextArgs, opts?: CustomResourceOptions);
@overload
def Ciphertext(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               context: Optional[Mapping[str, str]] = None,
               key_id: Optional[str] = None,
               plaintext: Optional[str] = None)
@overload
def Ciphertext(resource_name: str,
               args: CiphertextArgs,
               opts: Optional[ResourceOptions] = None)
func NewCiphertext(ctx *Context, name string, args CiphertextArgs, opts ...ResourceOption) (*Ciphertext, error)
public Ciphertext(string name, CiphertextArgs args, CustomResourceOptions? opts = null)
public Ciphertext(String name, CiphertextArgs args)
public Ciphertext(String name, CiphertextArgs args, CustomResourceOptions options)
type: aws:kms:Ciphertext
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CiphertextArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args CiphertextArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args CiphertextArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CiphertextArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CiphertextArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Ciphertext Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Ciphertext resource accepts the following input properties:

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 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 Mapping[str, str]

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>

An optional mapping that makes up the encryption context.

Outputs

All input properties are implicitly available as output properties. Additionally, the Ciphertext resource produces the following output properties:

CiphertextBlob string

Base64 encoded ciphertext

Id string

The provider-assigned unique ID for this managed resource.

CiphertextBlob string

Base64 encoded ciphertext

Id string

The provider-assigned unique ID for this managed resource.

ciphertextBlob String

Base64 encoded ciphertext

id String

The provider-assigned unique ID for this managed resource.

ciphertextBlob string

Base64 encoded ciphertext

id string

The provider-assigned unique ID for this managed resource.

ciphertext_blob str

Base64 encoded ciphertext

id str

The provider-assigned unique ID for this managed resource.

ciphertextBlob String

Base64 encoded ciphertext

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing Ciphertext Resource

Get an existing Ciphertext resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: CiphertextState, opts?: CustomResourceOptions): Ciphertext
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        ciphertext_blob: Optional[str] = None,
        context: Optional[Mapping[str, str]] = None,
        key_id: Optional[str] = None,
        plaintext: Optional[str] = None) -> Ciphertext
func GetCiphertext(ctx *Context, name string, id IDInput, state *CiphertextState, opts ...ResourceOption) (*Ciphertext, error)
public static Ciphertext Get(string name, Input<string> id, CiphertextState? state, CustomResourceOptions? opts = null)
public static Ciphertext get(String name, Output<String> id, CiphertextState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CiphertextBlob string

Base64 encoded ciphertext

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.

CiphertextBlob string

Base64 encoded ciphertext

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.

ciphertextBlob String

Base64 encoded ciphertext

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.

ciphertextBlob string

Base64 encoded ciphertext

context {[key: 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.

ciphertext_blob str

Base64 encoded ciphertext

context Mapping[str, str]

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.

ciphertextBlob String

Base64 encoded ciphertext

context Map<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.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.