GetSecretVersion
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
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = Output.Create(Aws.SecretsManager.GetSecretVersion.InvokeAsync(new Aws.SecretsManager.GetSecretVersionArgs
{
SecretId = data.Aws_secretsmanager_secret.Example.Id,
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := secretsmanager.LookupSecretVersion(ctx, &secretsmanager.LookupSecretVersionArgs{
SecretId: data.Aws_secretsmanager_secret.Example.Id,
}, nil)
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.secretsmanager.get_secret_version(secret_id=data["aws_secretsmanager_secret"]["example"]["id"])import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws_secretsmanager_secret_example.id.apply(id => aws.secretsmanager.getSecretVersion({
secretId: id,
}, { async: true }));Retrieve Specific Secret Version
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var by_version_stage = Output.Create(Aws.SecretsManager.GetSecretVersion.InvokeAsync(new Aws.SecretsManager.GetSecretVersionArgs
{
SecretId = data.Aws_secretsmanager_secret.Example.Id,
VersionStage = "example",
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := "example"
_, err := secretsmanager.LookupSecretVersion(ctx, &secretsmanager.LookupSecretVersionArgs{
SecretId: data.Aws_secretsmanager_secret.Example.Id,
VersionStage: &opt0,
}, nil)
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
by_version_stage = aws.secretsmanager.get_secret_version(secret_id=data["aws_secretsmanager_secret"]["example"]["id"],
version_stage="example")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const by_version_stage = aws_secretsmanager_secret_example.id.apply(id => aws.secretsmanager.getSecretVersion({
secretId: id,
versionStage: "example",
}, { async: true }));Using GetSecretVersion
function getSecretVersion(args: GetSecretVersionArgs, opts?: InvokeOptions): Promise<GetSecretVersionResult>function get_secret_version(secret_id=None, version_id=None, version_stage=None, opts=None)func LookupSecretVersion(ctx *Context, args *LookupSecretVersionArgs, opts ...InvokeOption) (*LookupSecretVersionResult, error)Note: This function is named
LookupSecretVersionin the Go SDK.
public static class GetSecretVersion {
public static Task<GetSecretVersionResult> InvokeAsync(GetSecretVersionArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Secret
Id string Specifies the secret containing the version that you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
- Version
Id string Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides
version_stage.- Version
Stage string Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to
AWSCURRENT.
- Secret
Id string Specifies the secret containing the version that you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
- Version
Id string Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides
version_stage.- Version
Stage string Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to
AWSCURRENT.
- secret
Id string Specifies the secret containing the version that you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
- version
Id string Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides
version_stage.- version
Stage string Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to
AWSCURRENT.
- secret_
id str Specifies the secret containing the version that you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
- version_
id str Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides
version_stage.- version_
stage str Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to
AWSCURRENT.
GetSecretVersion Result
The following output properties are available:
- Arn string
The ARN of the secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Secret
Binary string The decrypted part of the protected secret information that was originally provided as a binary. Base64 encoded.
- Secret
Id string - Secret
String string The decrypted part of the protected secret information that was originally provided as a string.
- Version
Id string The unique identifier of this version of the secret.
- Version
Stages List<string> - Version
Stage string
- Arn string
The ARN of the secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Secret
Binary string The decrypted part of the protected secret information that was originally provided as a binary. Base64 encoded.
- Secret
Id string - Secret
String string The decrypted part of the protected secret information that was originally provided as a string.
- Version
Id string The unique identifier of this version of the secret.
- Version
Stages []string - Version
Stage string
- arn string
The ARN of the secret.
- id string
The provider-assigned unique ID for this managed resource.
- secret
Binary string The decrypted part of the protected secret information that was originally provided as a binary. Base64 encoded.
- secret
Id string - secret
String string The decrypted part of the protected secret information that was originally provided as a string.
- version
Id string The unique identifier of this version of the secret.
- version
Stages string[] - version
Stage string
- arn str
The ARN of the secret.
- id str
The provider-assigned unique ID for this managed resource.
- secret_
binary str The decrypted part of the protected secret information that was originally provided as a binary. Base64 encoded.
- secret_
id str - secret_
string str The decrypted part of the protected secret information that was originally provided as a string.
- version_
id str The unique identifier of this version of the secret.
- version_
stages List[str] - version_
stage str
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.