1. Packages
  2. AWS Classic
  3. API Docs
  4. kms
  5. Ciphertext

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi

aws.kms.Ciphertext

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi

    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"
    }
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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
    	})
    }
    
    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 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.List;
    import java.util.ArrayList;
    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"
            }        
    

    Create Ciphertext Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Ciphertext(name: string, args: CiphertextArgs, opts?: CustomResourceOptions);
    @overload
    def Ciphertext(resource_name: str,
                   args: CiphertextArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def Ciphertext(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   key_id: Optional[str] = None,
                   plaintext: Optional[str] = None,
                   context: Optional[Mapping[str, str]] = 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.
    
    

    Parameters

    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.

    Example

    The following reference example uses placeholder values for all input properties.

    var ciphertextResource = new Aws.Kms.Ciphertext("ciphertextResource", new()
    {
        KeyId = "string",
        Plaintext = "string",
        Context = 
        {
            { "string", "string" },
        },
    });
    
    example, err := kms.NewCiphertext(ctx, "ciphertextResource", &kms.CiphertextArgs{
    	KeyId:     pulumi.String("string"),
    	Plaintext: pulumi.String("string"),
    	Context: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var ciphertextResource = new Ciphertext("ciphertextResource", CiphertextArgs.builder()        
        .keyId("string")
        .plaintext("string")
        .context(Map.of("string", "string"))
        .build());
    
    ciphertext_resource = aws.kms.Ciphertext("ciphertextResource",
        key_id="string",
        plaintext="string",
        context={
            "string": "string",
        })
    
    const ciphertextResource = new aws.kms.Ciphertext("ciphertextResource", {
        keyId: "string",
        plaintext: "string",
        context: {
            string: "string",
        },
    });
    
    type: aws:kms:Ciphertext
    properties:
        context:
            string: string
        keyId: string
        plaintext: string
    

    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 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
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi