1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kms
  5. Alias
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.kms.Alias

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Create an alias for the master key (CMK).

    NOTE: Available since v1.77.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const _this = new alicloud.kms.Key("this", {pendingWindowInDays: 7});
    const thisAlias = new alicloud.kms.Alias("this", {
        aliasName: "alias/example_kms_alias",
        keyId: _this.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    this = alicloud.kms.Key("this", pending_window_in_days=7)
    this_alias = alicloud.kms.Alias("this",
        alias_name="alias/example_kms_alias",
        key_id=this.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 {
    		this, err := kms.NewKey(ctx, "this", &kms.KeyArgs{
    			PendingWindowInDays: pulumi.Int(7),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kms.NewAlias(ctx, "this", &kms.AliasArgs{
    			AliasName: pulumi.String("alias/example_kms_alias"),
    			KeyId:     this.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @this = new AliCloud.Kms.Key("this", new()
        {
            PendingWindowInDays = 7,
        });
    
        var thisAlias = new AliCloud.Kms.Alias("this", new()
        {
            AliasName = "alias/example_kms_alias",
            KeyId = @this.Id,
        });
    
    });
    
    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.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 this_ = new Key("this", KeyArgs.builder()
                .pendingWindowInDays(7)
                .build());
    
            var thisAlias = new Alias("thisAlias", AliasArgs.builder()
                .aliasName("alias/example_kms_alias")
                .keyId(this_.id())
                .build());
    
        }
    }
    
    resources:
      this:
        type: alicloud:kms:Key
        properties:
          pendingWindowInDays: 7
      thisAlias:
        type: alicloud:kms:Alias
        name: this
        properties:
          aliasName: alias/example_kms_alias
          keyId: ${this.id}
    

    Create Alias Resource

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

    Constructor syntax

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

    Parameters

    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.

    Constructor example

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

    var alicloudAliasResource = new AliCloud.Kms.Alias("alicloudAliasResource", new()
    {
        AliasName = "string",
        KeyId = "string",
    });
    
    example, err := kms.NewAlias(ctx, "alicloudAliasResource", &kms.AliasArgs{
    	AliasName: pulumi.String("string"),
    	KeyId:     pulumi.String("string"),
    })
    
    var alicloudAliasResource = new Alias("alicloudAliasResource", AliasArgs.builder()
        .aliasName("string")
        .keyId("string")
        .build());
    
    alicloud_alias_resource = alicloud.kms.Alias("alicloudAliasResource",
        alias_name="string",
        key_id="string")
    
    const alicloudAliasResource = new alicloud.kms.Alias("alicloudAliasResource", {
        aliasName: "string",
        keyId: "string",
    });
    
    type: alicloud:kms:Alias
    properties:
        aliasName: string
        keyId: string
    

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

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

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    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.

    NOTE: Each alias represents only one master key(CMK).

    NOTE: Within an area of the same user, alias is not reproducible.

    NOTE: UpdateAlias can be used to update the mapping relationship between alias and master key(CMK).

    Import

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

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

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi