Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

Alias

Create an alias for the master key (CMK).

NOTE: Available in v1.77.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var thisKey = new AliCloud.Kms.Key("thisKey", new AliCloud.Kms.KeyArgs
        {
        });
        var thisAlias = new AliCloud.Kms.Alias("thisAlias", new AliCloud.Kms.AliasArgs
        {
            AliasName = "alias/test_kms_alias",
            KeyId = thisKey.Id,
        });
    }

}
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 {
		thisKey, err := kms.NewKey(ctx, "thisKey", nil)
		if err != nil {
			return err
		}
		_, err = kms.NewAlias(ctx, "thisAlias", &kms.AliasArgs{
			AliasName: pulumi.String("alias/test_kms_alias"),
			KeyId:     thisKey.ID(),
		})
		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.Alias;
import com.pulumi.alicloud.kms.AliasArgs;
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 thisKey = new Key("thisKey");

        var thisAlias = new Alias("thisAlias", AliasArgs.builder()        
            .aliasName("alias/test_kms_alias")
            .keyId(thisKey.id())
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

this_key = alicloud.kms.Key("thisKey")
this_alias = alicloud.kms.Alias("thisAlias",
    alias_name="alias/test_kms_alias",
    key_id=this_key.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const thisKey = new alicloud.kms.Key("thisKey", {});
const thisAlias = new alicloud.kms.Alias("thisAlias", {
    aliasName: "alias/test_kms_alias",
    keyId: thisKey.id,
});
resources:
  thisKey:
    type: alicloud:kms:Key
  thisAlias:
    type: alicloud:kms:Alias
    properties:
      aliasName: alias/test_kms_alias
      keyId: ${thisKey.id}

Create a Alias Resource

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

name string
The unique name of the resource.
args AliasArgs
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 AliasArgs
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 AliasArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AliasArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AliasArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Alias 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 Alias resource accepts the following input properties:

AliasName string

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

KeyId string

The id of the key.

AliasName string

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

KeyId string

The id of the key.

aliasName String

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

keyId String

The id of the key.

aliasName string

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

keyId string

The id of the key.

alias_name str

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

key_id str

The id of the key.

aliasName String

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

keyId String

The id of the key.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing Alias Resource

Get an existing Alias 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?: AliasState, opts?: CustomResourceOptions): Alias
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alias_name: Optional[str] = None,
        key_id: Optional[str] = None) -> Alias
func GetAlias(ctx *Context, name string, id IDInput, state *AliasState, opts ...ResourceOption) (*Alias, error)
public static Alias Get(string name, Input<string> id, AliasState? state, CustomResourceOptions? opts = null)
public static Alias get(String name, Output<String> id, AliasState 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:
AliasName string

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

KeyId string

The id of the key.

AliasName string

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

KeyId string

The id of the key.

aliasName String

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

keyId String

The id of the key.

aliasName string

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

keyId string

The id of the key.

alias_name str

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

key_id str

The id of the key.

aliasName String

The alias of CMK. EncryptGenerateDataKeyDescribeKey can be called using aliases. Length of characters other than prefixes: minimum length of 1 character and maximum length of 255 characters. Must contain prefix alias/.

keyId String

The id of the key.

Import

KMS alias can be imported using the id, e.g.

 $ pulumi import alicloud:kms/alias:Alias example alias/test_kms_alias

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.