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

alicloud.kms.getSecretVersions

Explore with Pulumi AI

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

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

    NOTE: Available in v1.88.0+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    // Declare the data source
    const kmsSecretVersionsDs = alicloud.kms.getSecretVersions({
        secretName: "secret_name",
        enableDetails: true,
    });
    export const firstSecretData = kmsSecretVersionsDs.then(kmsSecretVersionsDs => kmsSecretVersionsDs.versions?.[0]?.secretData);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    # Declare the data source
    kms_secret_versions_ds = alicloud.kms.get_secret_versions(secret_name="secret_name",
        enable_details=True)
    pulumi.export("firstSecretData", kms_secret_versions_ds.versions[0].secret_data)
    
    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
    		kmsSecretVersionsDs, err := kms.GetSecretVersions(ctx, &kms.GetSecretVersionsArgs{
    			SecretName:    "secret_name",
    			EnableDetails: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstSecretData", kmsSecretVersionsDs.Versions[0].SecretData)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        // Declare the data source
        var kmsSecretVersionsDs = AliCloud.Kms.GetSecretVersions.Invoke(new()
        {
            SecretName = "secret_name",
            EnableDetails = true,
        });
    
        return new Dictionary<string, object?>
        {
            ["firstSecretData"] = kmsSecretVersionsDs.Apply(getSecretVersionsResult => getSecretVersionsResult.Versions[0]?.SecretData),
        };
    });
    
    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.GetSecretVersionsArgs;
    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 kmsSecretVersionsDs = KmsFunctions.getSecretVersions(GetSecretVersionsArgs.builder()
                .secretName("secret_name")
                .enableDetails(true)
                .build());
    
            ctx.export("firstSecretData", kmsSecretVersionsDs.applyValue(getSecretVersionsResult -> getSecretVersionsResult.versions()[0].secretData()));
        }
    }
    
    variables:
      # Declare the data source
      kmsSecretVersionsDs:
        fn::invoke:
          Function: alicloud:kms:getSecretVersions
          Arguments:
            secretName: secret_name
            enableDetails: true
    outputs:
      firstSecretData: ${kmsSecretVersionsDs.versions[0].secretData}
    

    Using getSecretVersions

    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 getSecretVersions(args: GetSecretVersionsArgs, opts?: InvokeOptions): Promise<GetSecretVersionsResult>
    function getSecretVersionsOutput(args: GetSecretVersionsOutputArgs, opts?: InvokeOptions): Output<GetSecretVersionsResult>
    def get_secret_versions(enable_details: Optional[bool] = None,
                            ids: Optional[Sequence[str]] = None,
                            include_deprecated: Optional[str] = None,
                            output_file: Optional[str] = None,
                            secret_name: Optional[str] = None,
                            version_stage: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetSecretVersionsResult
    def get_secret_versions_output(enable_details: Optional[pulumi.Input[bool]] = None,
                            ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                            include_deprecated: Optional[pulumi.Input[str]] = None,
                            output_file: Optional[pulumi.Input[str]] = None,
                            secret_name: Optional[pulumi.Input[str]] = None,
                            version_stage: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetSecretVersionsResult]
    func GetSecretVersions(ctx *Context, args *GetSecretVersionsArgs, opts ...InvokeOption) (*GetSecretVersionsResult, error)
    func GetSecretVersionsOutput(ctx *Context, args *GetSecretVersionsOutputArgs, opts ...InvokeOption) GetSecretVersionsResultOutput

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

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

    The following arguments are supported:

    SecretName string
    The name of the secret.
    EnableDetails bool
    Default to false and only output secret_name, version_id, version_stages. Set it to true can output more details.
    Ids List<string>
    A list of KMS Secret Version ids.
    IncludeDeprecated string
    Specifies whether to return deprecated secret versions. Default to false.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    VersionStage string
    The stage of the secret version.
    SecretName string
    The name of the secret.
    EnableDetails bool
    Default to false and only output secret_name, version_id, version_stages. Set it to true can output more details.
    Ids []string
    A list of KMS Secret Version ids.
    IncludeDeprecated string
    Specifies whether to return deprecated secret versions. Default to false.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    VersionStage string
    The stage of the secret version.
    secretName String
    The name of the secret.
    enableDetails Boolean
    Default to false and only output secret_name, version_id, version_stages. Set it to true can output more details.
    ids List<String>
    A list of KMS Secret Version ids.
    includeDeprecated String
    Specifies whether to return deprecated secret versions. Default to false.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    versionStage String
    The stage of the secret version.
    secretName string
    The name of the secret.
    enableDetails boolean
    Default to false and only output secret_name, version_id, version_stages. Set it to true can output more details.
    ids string[]
    A list of KMS Secret Version ids.
    includeDeprecated string
    Specifies whether to return deprecated secret versions. Default to false.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    versionStage string
    The stage of the secret version.
    secret_name str
    The name of the secret.
    enable_details bool
    Default to false and only output secret_name, version_id, version_stages. Set it to true can output more details.
    ids Sequence[str]
    A list of KMS Secret Version ids.
    include_deprecated str
    Specifies whether to return deprecated secret versions. Default to false.
    output_file str
    File name where to save data source results (after running pulumi preview).
    version_stage str
    The stage of the secret version.
    secretName String
    The name of the secret.
    enableDetails Boolean
    Default to false and only output secret_name, version_id, version_stages. Set it to true can output more details.
    ids List<String>
    A list of KMS Secret Version ids.
    includeDeprecated String
    Specifies whether to return deprecated secret versions. Default to false.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    versionStage String
    The stage of the secret version.

    getSecretVersions 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 Secret Version ids.
    SecretName string
    The name of the secret.
    Versions List<Pulumi.AliCloud.Kms.Outputs.GetSecretVersionsVersion>
    A list of KMS Secret Versions. Each element contains the following attributes:
    EnableDetails bool
    IncludeDeprecated string
    OutputFile string
    VersionStage string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of Kms Secret Version ids.
    SecretName string
    The name of the secret.
    Versions []GetSecretVersionsVersion
    A list of KMS Secret Versions. Each element contains the following attributes:
    EnableDetails bool
    IncludeDeprecated string
    OutputFile string
    VersionStage string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Kms Secret Version ids.
    secretName String
    The name of the secret.
    versions List<GetSecretVersionsVersion>
    A list of KMS Secret Versions. Each element contains the following attributes:
    enableDetails Boolean
    includeDeprecated String
    outputFile String
    versionStage String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of Kms Secret Version ids.
    secretName string
    The name of the secret.
    versions GetSecretVersionsVersion[]
    A list of KMS Secret Versions. Each element contains the following attributes:
    enableDetails boolean
    includeDeprecated string
    outputFile string
    versionStage string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of Kms Secret Version ids.
    secret_name str
    The name of the secret.
    versions Sequence[GetSecretVersionsVersion]
    A list of KMS Secret Versions. Each element contains the following attributes:
    enable_details bool
    include_deprecated str
    output_file str
    version_stage str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Kms Secret Version ids.
    secretName String
    The name of the secret.
    versions List<Property Map>
    A list of KMS Secret Versions. Each element contains the following attributes:
    enableDetails Boolean
    includeDeprecated String
    outputFile String
    versionStage String

    Supporting Types

    GetSecretVersionsVersion

    SecretData string
    The secret value. Secrets Manager decrypts the stored secret value in ciphertext and returns it. (Returned when enable_details is true).
    SecretDataType string
    The type of the secret value. (Returned when enable_details is true).
    SecretName string
    The name of the secret.
    VersionId string
    The version number of the secret value.
    VersionStages List<string>
    Stage labels that mark the secret version.
    SecretData string
    The secret value. Secrets Manager decrypts the stored secret value in ciphertext and returns it. (Returned when enable_details is true).
    SecretDataType string
    The type of the secret value. (Returned when enable_details is true).
    SecretName string
    The name of the secret.
    VersionId string
    The version number of the secret value.
    VersionStages []string
    Stage labels that mark the secret version.
    secretData String
    The secret value. Secrets Manager decrypts the stored secret value in ciphertext and returns it. (Returned when enable_details is true).
    secretDataType String
    The type of the secret value. (Returned when enable_details is true).
    secretName String
    The name of the secret.
    versionId String
    The version number of the secret value.
    versionStages List<String>
    Stage labels that mark the secret version.
    secretData string
    The secret value. Secrets Manager decrypts the stored secret value in ciphertext and returns it. (Returned when enable_details is true).
    secretDataType string
    The type of the secret value. (Returned when enable_details is true).
    secretName string
    The name of the secret.
    versionId string
    The version number of the secret value.
    versionStages string[]
    Stage labels that mark the secret version.
    secret_data str
    The secret value. Secrets Manager decrypts the stored secret value in ciphertext and returns it. (Returned when enable_details is true).
    secret_data_type str
    The type of the secret value. (Returned when enable_details is true).
    secret_name str
    The name of the secret.
    version_id str
    The version number of the secret value.
    version_stages Sequence[str]
    Stage labels that mark the secret version.
    secretData String
    The secret value. Secrets Manager decrypts the stored secret value in ciphertext and returns it. (Returned when enable_details is true).
    secretDataType String
    The type of the secret value. (Returned when enable_details is true).
    secretName String
    The name of the secret.
    versionId String
    The version number of the secret value.
    versionStages List<String>
    Stage labels that mark the secret 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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi