alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.kms.Ciphertext

Example Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var key = new AliCloud.Kms.Key("key", new()
    {
        Description = "example key",
        IsEnabled = true,
    });

    var encrypted = new AliCloud.Kms.Ciphertext("encrypted", new()
    {
        KeyId = key.Id,
        Plaintext = "example",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		key, err := kms.NewKey(ctx, "key", &kms.KeyArgs{
			Description: pulumi.String("example key"),
			IsEnabled:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = kms.NewCiphertext(ctx, "encrypted", &kms.CiphertextArgs{
			KeyId:     key.ID(),
			Plaintext: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.Key;
import com.pulumi.alicloud.kms.KeyArgs;
import com.pulumi.alicloud.kms.Ciphertext;
import com.pulumi.alicloud.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 key = new Key("key", KeyArgs.builder()        
            .description("example key")
            .isEnabled(true)
            .build());

        var encrypted = new Ciphertext("encrypted", CiphertextArgs.builder()        
            .keyId(key.id())
            .plaintext("example")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

key = alicloud.kms.Key("key",
    description="example key",
    is_enabled=True)
encrypted = alicloud.kms.Ciphertext("encrypted",
    key_id=key.id,
    plaintext="example")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const key = new alicloud.kms.Key("key", {
    description: "example key",
    isEnabled: true,
});
const encrypted = new alicloud.kms.Ciphertext("encrypted", {
    keyId: key.id,
    plaintext: "example",
});
resources:
  key:
    type: alicloud:kms:Key
    properties:
      description: example key
      isEnabled: true
  encrypted:
    type: alicloud:kms:Ciphertext
    properties:
      keyId: ${key.id}
      plaintext: example

Create Ciphertext Resource

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

The globally unique ID of the CMK.

Plaintext string

The plaintext to be encrypted which must be encoded in Base64.

EncryptionContext Dictionary<string, string>

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

KeyId string

The globally unique ID of the CMK.

Plaintext string

The plaintext to be encrypted which must be encoded in Base64.

EncryptionContext map[string]string

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

keyId String

The globally unique ID of the CMK.

plaintext String

The plaintext to be encrypted which must be encoded in Base64.

encryptionContext Map<String,String>

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

keyId string

The globally unique ID of the CMK.

plaintext string

The plaintext to be encrypted which must be encoded in Base64.

encryptionContext {[key: string]: string}

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

key_id str

The globally unique ID of the CMK.

plaintext str

The plaintext to be encrypted which must be encoded in Base64.

encryption_context Mapping[str, str]

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

keyId String

The globally unique ID of the CMK.

plaintext String

The plaintext to be encrypted which must be encoded in Base64.

encryptionContext Map<String>

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

Outputs

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

CiphertextBlob string

The ciphertext of the data key encrypted with the primary CMK version.

Id string

The provider-assigned unique ID for this managed resource.

CiphertextBlob string

The ciphertext of the data key encrypted with the primary CMK version.

Id string

The provider-assigned unique ID for this managed resource.

ciphertextBlob String

The ciphertext of the data key encrypted with the primary CMK version.

id String

The provider-assigned unique ID for this managed resource.

ciphertextBlob string

The ciphertext of the data key encrypted with the primary CMK version.

id string

The provider-assigned unique ID for this managed resource.

ciphertext_blob str

The ciphertext of the data key encrypted with the primary CMK version.

id str

The provider-assigned unique ID for this managed resource.

ciphertextBlob String

The ciphertext of the data key encrypted with the primary CMK version.

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,
        encryption_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

The ciphertext of the data key encrypted with the primary CMK version.

EncryptionContext Dictionary<string, string>

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

KeyId string

The globally unique ID of the CMK.

Plaintext string

The plaintext to be encrypted which must be encoded in Base64.

CiphertextBlob string

The ciphertext of the data key encrypted with the primary CMK version.

EncryptionContext map[string]string

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

KeyId string

The globally unique ID of the CMK.

Plaintext string

The plaintext to be encrypted which must be encoded in Base64.

ciphertextBlob String

The ciphertext of the data key encrypted with the primary CMK version.

encryptionContext Map<String,String>

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

keyId String

The globally unique ID of the CMK.

plaintext String

The plaintext to be encrypted which must be encoded in Base64.

ciphertextBlob string

The ciphertext of the data key encrypted with the primary CMK version.

encryptionContext {[key: string]: string}

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

keyId string

The globally unique ID of the CMK.

plaintext string

The plaintext to be encrypted which must be encoded in Base64.

ciphertext_blob str

The ciphertext of the data key encrypted with the primary CMK version.

encryption_context Mapping[str, str]

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

key_id str

The globally unique ID of the CMK.

plaintext str

The plaintext to be encrypted which must be encoded in Base64.

ciphertextBlob String

The ciphertext of the data key encrypted with the primary CMK version.

encryptionContext Map<String>

(Optional, ForceNew) The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

keyId String

The globally unique ID of the CMK.

plaintext String

The plaintext to be encrypted which must be encoded in Base64.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.