1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kms
  5. getKeyVersions
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.kms.getKeyVersions

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    This data source provides a list of KMS KeyVersions in an Alibaba Cloud account according to the specified filters.

    NOTE: Available in v1.85.0+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const alicloudKmsKeyVersionsDs = alicloud.kms.getKeyVersions({
        ids: ["d89e8a53-b708-41aa-8c67-6873axxx"],
        keyId: "08438c-b4d5-4d05-928c-07b7xxxx",
    });
    export const allVersions = alicloudKmsKeyVersionsDs.then(alicloudKmsKeyVersionsDs => alicloudKmsKeyVersionsDs.versions);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    alicloud_kms_key_versions_ds = alicloud.kms.get_key_versions(ids=["d89e8a53-b708-41aa-8c67-6873axxx"],
        key_id="08438c-b4d5-4d05-928c-07b7xxxx")
    pulumi.export("allVersions", alicloud_kms_key_versions_ds.versions)
    
    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 {
    		alicloudKmsKeyVersionsDs, err := kms.GetKeyVersions(ctx, &kms.GetKeyVersionsArgs{
    			Ids: []string{
    				"d89e8a53-b708-41aa-8c67-6873axxx",
    			},
    			KeyId: "08438c-b4d5-4d05-928c-07b7xxxx",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("allVersions", alicloudKmsKeyVersionsDs.Versions)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var alicloudKmsKeyVersionsDs = AliCloud.Kms.GetKeyVersions.Invoke(new()
        {
            Ids = new[]
            {
                "d89e8a53-b708-41aa-8c67-6873axxx",
            },
            KeyId = "08438c-b4d5-4d05-928c-07b7xxxx",
        });
    
        return new Dictionary<string, object?>
        {
            ["allVersions"] = alicloudKmsKeyVersionsDs.Apply(getKeyVersionsResult => getKeyVersionsResult.Versions),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.kms.KmsFunctions;
    import com.pulumi.alicloud.kms.inputs.GetKeyVersionsArgs;
    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) {
            final var alicloudKmsKeyVersionsDs = KmsFunctions.getKeyVersions(GetKeyVersionsArgs.builder()
                .ids("d89e8a53-b708-41aa-8c67-6873axxx")
                .keyId("08438c-b4d5-4d05-928c-07b7xxxx")
                .build());
    
            ctx.export("allVersions", alicloudKmsKeyVersionsDs.applyValue(getKeyVersionsResult -> getKeyVersionsResult.versions()));
        }
    }
    
    variables:
      alicloudKmsKeyVersionsDs:
        fn::invoke:
          Function: alicloud:kms:getKeyVersions
          Arguments:
            ids:
              - d89e8a53-b708-41aa-8c67-6873axxx
            keyId: 08438c-b4d5-4d05-928c-07b7xxxx
    outputs:
      allVersions: ${alicloudKmsKeyVersionsDs.versions}
    

    Using getKeyVersions

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getKeyVersions(args: GetKeyVersionsArgs, opts?: InvokeOptions): Promise<GetKeyVersionsResult>
    function getKeyVersionsOutput(args: GetKeyVersionsOutputArgs, opts?: InvokeOptions): Output<GetKeyVersionsResult>
    def get_key_versions(ids: Optional[Sequence[str]] = None,
                         key_id: Optional[str] = None,
                         output_file: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetKeyVersionsResult
    def get_key_versions_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                         key_id: Optional[pulumi.Input[str]] = None,
                         output_file: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetKeyVersionsResult]
    func GetKeyVersions(ctx *Context, args *GetKeyVersionsArgs, opts ...InvokeOption) (*GetKeyVersionsResult, error)
    func GetKeyVersionsOutput(ctx *Context, args *GetKeyVersionsOutputArgs, opts ...InvokeOption) GetKeyVersionsResultOutput

    > Note: This function is named GetKeyVersions in the Go SDK.

    public static class GetKeyVersions 
    {
        public static Task<GetKeyVersionsResult> InvokeAsync(GetKeyVersionsArgs args, InvokeOptions? opts = null)
        public static Output<GetKeyVersionsResult> Invoke(GetKeyVersionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKeyVersionsResult> getKeyVersions(GetKeyVersionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:kms/getKeyVersions:getKeyVersions
      arguments:
        # arguments dictionary

    The following arguments are supported:

    KeyId string
    The id of kms key.
    Ids List<string>
    A list of KMS KeyVersion IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    KeyId string
    The id of kms key.
    Ids []string
    A list of KMS KeyVersion IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    keyId String
    The id of kms key.
    ids List<String>
    A list of KMS KeyVersion IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    keyId string
    The id of kms key.
    ids string[]
    A list of KMS KeyVersion IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    key_id str
    The id of kms key.
    ids Sequence[str]
    A list of KMS KeyVersion IDs.
    output_file str
    File name where to save data source results (after running pulumi preview).
    keyId String
    The id of kms key.
    ids List<String>
    A list of KMS KeyVersion IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getKeyVersions Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of KMS KeyVersion IDs.
    KeyId string
    ID of the key.
    Versions List<Pulumi.AliCloud.Kms.Outputs.GetKeyVersionsVersion>
    A list of KMS KeyVersions. Each element contains the following attributes:
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of KMS KeyVersion IDs.
    KeyId string
    ID of the key.
    Versions []GetKeyVersionsVersion
    A list of KMS KeyVersions. Each element contains the following attributes:
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of KMS KeyVersion IDs.
    keyId String
    ID of the key.
    versions List<GetKeyVersionsVersion>
    A list of KMS KeyVersions. Each element contains the following attributes:
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of KMS KeyVersion IDs.
    keyId string
    ID of the key.
    versions GetKeyVersionsVersion[]
    A list of KMS KeyVersions. Each element contains the following attributes:
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of KMS KeyVersion IDs.
    key_id str
    ID of the key.
    versions Sequence[GetKeyVersionsVersion]
    A list of KMS KeyVersions. Each element contains the following attributes:
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of KMS KeyVersion IDs.
    keyId String
    ID of the key.
    versions List<Property Map>
    A list of KMS KeyVersions. Each element contains the following attributes:
    outputFile String

    Supporting Types

    GetKeyVersionsVersion

    CreateTime string
    Date and time when the key version was created (UTC time).
    CreationDate string
    (Removed from v1.124.4) It has been removed and using create_time instead.
    Id string
    ID of the KMS KeyVersion resource.
    KeyId string
    The id of kms key.
    KeyVersionId string
    ID of the key version.
    CreateTime string
    Date and time when the key version was created (UTC time).
    CreationDate string
    (Removed from v1.124.4) It has been removed and using create_time instead.
    Id string
    ID of the KMS KeyVersion resource.
    KeyId string
    The id of kms key.
    KeyVersionId string
    ID of the key version.
    createTime String
    Date and time when the key version was created (UTC time).
    creationDate String
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id String
    ID of the KMS KeyVersion resource.
    keyId String
    The id of kms key.
    keyVersionId String
    ID of the key version.
    createTime string
    Date and time when the key version was created (UTC time).
    creationDate string
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id string
    ID of the KMS KeyVersion resource.
    keyId string
    The id of kms key.
    keyVersionId string
    ID of the key version.
    create_time str
    Date and time when the key version was created (UTC time).
    creation_date str
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id str
    ID of the KMS KeyVersion resource.
    key_id str
    The id of kms key.
    key_version_id str
    ID of the key version.
    createTime String
    Date and time when the key version was created (UTC time).
    creationDate String
    (Removed from v1.124.4) It has been removed and using create_time instead.
    id String
    ID of the KMS KeyVersion resource.
    keyId String
    The id of kms key.
    keyVersionId String
    ID of the key version.

    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.53.0 published on Wednesday, Apr 17, 2024 by Pulumi