1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. kms
  5. getKeyVersions
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.kms.getKeyVersions

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 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";

// Declare the data source
const alicloudKmsKeyVersionsDs = alicloud.kms.getKeyVersions({
    keyId: "08438c-b4d5-4d05-928c-07b7xxxx",
    ids: ["d89e8a53-b708-41aa-8c67-6873axxx"],
});
export const allVersions = alicloudKmsKeyVersionsDs.then(alicloudKmsKeyVersionsDs => alicloudKmsKeyVersionsDs.versions);
Copy
import pulumi
import pulumi_alicloud as alicloud

# Declare the data source
alicloud_kms_key_versions_ds = alicloud.kms.get_key_versions(key_id="08438c-b4d5-4d05-928c-07b7xxxx",
    ids=["d89e8a53-b708-41aa-8c67-6873axxx"])
pulumi.export("allVersions", alicloud_kms_key_versions_ds.versions)
Copy
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 {
		// Declare the data source
		alicloudKmsKeyVersionsDs, err := kms.GetKeyVersions(ctx, &kms.GetKeyVersionsArgs{
			KeyId: "08438c-b4d5-4d05-928c-07b7xxxx",
			Ids: []string{
				"d89e8a53-b708-41aa-8c67-6873axxx",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("allVersions", alicloudKmsKeyVersionsDs.Versions)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    // Declare the data source
    var alicloudKmsKeyVersionsDs = AliCloud.Kms.GetKeyVersions.Invoke(new()
    {
        KeyId = "08438c-b4d5-4d05-928c-07b7xxxx",
        Ids = new[]
        {
            "d89e8a53-b708-41aa-8c67-6873axxx",
        },
    });

    return new Dictionary<string, object?>
    {
        ["allVersions"] = alicloudKmsKeyVersionsDs.Apply(getKeyVersionsResult => getKeyVersionsResult.Versions),
    };
});
Copy
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) {
        // Declare the data source
        final var alicloudKmsKeyVersionsDs = KmsFunctions.getKeyVersions(GetKeyVersionsArgs.builder()
            .keyId("08438c-b4d5-4d05-928c-07b7xxxx")
            .ids("d89e8a53-b708-41aa-8c67-6873axxx")
            .build());

        ctx.export("allVersions", alicloudKmsKeyVersionsDs.applyValue(getKeyVersionsResult -> getKeyVersionsResult.versions()));
    }
}
Copy
variables:
  # Declare the data source
  alicloudKmsKeyVersionsDs:
    fn::invoke:
      function: alicloud:kms:getKeyVersions
      arguments:
        keyId: 08438c-b4d5-4d05-928c-07b7xxxx
        ids:
          - d89e8a53-b708-41aa-8c67-6873axxx
outputs:
  allVersions: ${alicloudKmsKeyVersionsDs.versions}
Copy

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>
Copy
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]
Copy
func GetKeyVersions(ctx *Context, args *GetKeyVersionsArgs, opts ...InvokeOption) (*GetKeyVersionsResult, error)
func GetKeyVersionsOutput(ctx *Context, args *GetKeyVersionsOutputArgs, opts ...InvokeOption) GetKeyVersionsResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetKeyVersionsResult> getKeyVersions(GetKeyVersionsArgs args, InvokeOptions options)
public static Output<GetKeyVersionsResult> getKeyVersions(GetKeyVersionsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:kms/getKeyVersions:getKeyVersions
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

KeyId
This property is required.
Changes to this property will trigger replacement.
string
The id of kms key.
Ids Changes to this property will trigger replacement. List<string>
A list of KMS KeyVersion IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
KeyId
This property is required.
Changes to this property will trigger replacement.
string
The id of kms key.
Ids Changes to this property will trigger replacement. []string
A list of KMS KeyVersion IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
keyId
This property is required.
Changes to this property will trigger replacement.
String
The id of kms key.
ids Changes to this property will trigger replacement. List<String>
A list of KMS KeyVersion IDs.
outputFile String
File name where to save data source results (after running pulumi preview).
keyId
This property is required.
Changes to this property will trigger replacement.
string
The id of kms key.
ids Changes to this property will trigger replacement. string[]
A list of KMS KeyVersion IDs.
outputFile string
File name where to save data source results (after running pulumi preview).
key_id
This property is required.
Changes to this property will trigger replacement.
str
The id of kms key.
ids Changes to this property will trigger replacement. Sequence[str]
A list of KMS KeyVersion IDs.
output_file str
File name where to save data source results (after running pulumi preview).
keyId
This property is required.
Changes to this property will trigger replacement.
String
The id of kms key.
ids Changes to this property will trigger replacement. 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 This property is required. string
Date and time when the key version was created (UTC time).
CreationDate This property is required. string
(Removed from v1.124.4) It has been removed and using create_time instead.
Id This property is required. string
ID of the KMS KeyVersion resource.
KeyId This property is required. string
The id of kms key.
KeyVersionId This property is required. string
ID of the key version.
CreateTime This property is required. string
Date and time when the key version was created (UTC time).
CreationDate This property is required. string
(Removed from v1.124.4) It has been removed and using create_time instead.
Id This property is required. string
ID of the KMS KeyVersion resource.
KeyId This property is required. string
The id of kms key.
KeyVersionId This property is required. string
ID of the key version.
createTime This property is required. String
Date and time when the key version was created (UTC time).
creationDate This property is required. String
(Removed from v1.124.4) It has been removed and using create_time instead.
id This property is required. String
ID of the KMS KeyVersion resource.
keyId This property is required. String
The id of kms key.
keyVersionId This property is required. String
ID of the key version.
createTime This property is required. string
Date and time when the key version was created (UTC time).
creationDate This property is required. string
(Removed from v1.124.4) It has been removed and using create_time instead.
id This property is required. string
ID of the KMS KeyVersion resource.
keyId This property is required. string
The id of kms key.
keyVersionId This property is required. string
ID of the key version.
create_time This property is required. str
Date and time when the key version was created (UTC time).
creation_date This property is required. str
(Removed from v1.124.4) It has been removed and using create_time instead.
id This property is required. str
ID of the KMS KeyVersion resource.
key_id This property is required. str
The id of kms key.
key_version_id This property is required. str
ID of the key version.
createTime This property is required. String
Date and time when the key version was created (UTC time).
creationDate This property is required. String
(Removed from v1.124.4) It has been removed and using create_time instead.
id This property is required. String
ID of the KMS KeyVersion resource.
keyId This property is required. String
The id of kms key.
keyVersionId This property is required. 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.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi