1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kms
  5. Alias
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.kms.Alias

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 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 thisKey = new alicloud.kms.Key("thisKey", {pendingWindowInDays: 7});
    const thisAlias = new alicloud.kms.Alias("thisAlias", {
        aliasName: "alias/example_kms_alias",
        keyId: thisKey.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    this_key = alicloud.kms.Key("thisKey", pending_window_in_days=7)
    this_alias = alicloud.kms.Alias("thisAlias",
        alias_name="alias/example_kms_alias",
        key_id=this_key.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", &kms.KeyArgs{
    			PendingWindowInDays: pulumi.Int(7),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kms.NewAlias(ctx, "thisAlias", &kms.AliasArgs{
    			AliasName: pulumi.String("alias/example_kms_alias"),
    			KeyId:     thisKey.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 thisKey = new AliCloud.Kms.Key("thisKey", new()
        {
            PendingWindowInDays = 7,
        });
    
        var thisAlias = new AliCloud.Kms.Alias("thisAlias", new()
        {
            AliasName = "alias/example_kms_alias",
            KeyId = thisKey.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 thisKey = new Key("thisKey", KeyArgs.builder()        
                .pendingWindowInDays(7)
                .build());
    
            var thisAlias = new Alias("thisAlias", AliasArgs.builder()        
                .aliasName("alias/example_kms_alias")
                .keyId(thisKey.id())
                .build());
    
        }
    }
    
    resources:
      thisKey:
        type: alicloud:kms:Key
        properties:
          pendingWindowInDays: 7
      thisAlias:
        type: alicloud:kms:Alias
        properties:
          aliasName: alias/example_kms_alias
          keyId: ${thisKey.id}
    

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

    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
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi