UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

165 lines (164 loc) 5.47 kB
import * as pulumi from "@pulumi/pulumi"; /** * Retrieve information about a Secrets Manager secret version, including its secret value. To retrieve secret metadata, see the `aws.secretsmanager.Secret` data source. * * ## Example Usage * * ### Retrieve Current Secret Version * * By default, this data sources retrieves information based on the `AWSCURRENT` staging label. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const secret_version = aws.secretsmanager.getSecretVersion({ * secretId: example.id, * }); * ``` * * ### Retrieve Specific Secret Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const by_version_stage = aws.secretsmanager.getSecretVersion({ * secretId: example.id, * versionStage: "example", * }); * ``` * * ### Handling Key-Value Secret Strings in JSON * * Reading key-value pairs from JSON back into a native map * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as std from "@pulumi/std"; * * export const example = std.jsondecode({ * input: exampleAwsSecretsmanagerSecretVersion.secretString, * }).then(invoke => invoke.result?.key1); * ``` */ export declare function getSecretVersion(args: GetSecretVersionArgs, opts?: pulumi.InvokeOptions): Promise<GetSecretVersionResult>; /** * A collection of arguments for invoking getSecretVersion. */ export interface GetSecretVersionArgs { /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: string; /** * Specifies the secret containing the version that you want to retrieve. You can specify either the ARN or the friendly name of the secret. */ secretId: string; /** * Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides `versionStage`. */ versionId?: string; /** * Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to `AWSCURRENT`. */ versionStage?: string; } /** * A collection of values returned by getSecretVersion. */ export interface GetSecretVersionResult { /** * ARN of the secret. */ readonly arn: string; /** * Created date of the secret in UTC. */ readonly createdDate: string; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; readonly region: string; /** * Decrypted part of the protected secret information that was originally provided as a binary. */ readonly secretBinary: string; readonly secretId: string; /** * Decrypted part of the protected secret information that was originally provided as a string. */ readonly secretString: string; /** * Unique identifier of this version of the secret. */ readonly versionId: string; readonly versionStage?: string; readonly versionStages: string[]; } /** * Retrieve information about a Secrets Manager secret version, including its secret value. To retrieve secret metadata, see the `aws.secretsmanager.Secret` data source. * * ## Example Usage * * ### Retrieve Current Secret Version * * By default, this data sources retrieves information based on the `AWSCURRENT` staging label. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const secret_version = aws.secretsmanager.getSecretVersion({ * secretId: example.id, * }); * ``` * * ### Retrieve Specific Secret Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const by_version_stage = aws.secretsmanager.getSecretVersion({ * secretId: example.id, * versionStage: "example", * }); * ``` * * ### Handling Key-Value Secret Strings in JSON * * Reading key-value pairs from JSON back into a native map * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as std from "@pulumi/std"; * * export const example = std.jsondecode({ * input: exampleAwsSecretsmanagerSecretVersion.secretString, * }).then(invoke => invoke.result?.key1); * ``` */ export declare function getSecretVersionOutput(args: GetSecretVersionOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetSecretVersionResult>; /** * A collection of arguments for invoking getSecretVersion. */ export interface GetSecretVersionOutputArgs { /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Specifies the secret containing the version that you want to retrieve. You can specify either the ARN or the friendly name of the secret. */ secretId: pulumi.Input<string>; /** * Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides `versionStage`. */ versionId?: pulumi.Input<string>; /** * Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to `AWSCURRENT`. */ versionStage?: pulumi.Input<string>; }