SecretVersion
Provides a resource to manage AWS Secrets Manager secret version including its secret value. To manage secret metadata, see the aws.secretsmanager.Secret resource.
NOTE: If the
AWSCURRENTstaging label is present on this version during resource deletion, that label cannot be removed and will be skipped to prevent errors when fully deleting the secret. That label will leave this secret version active even after the resource is deleted from this provider unless the secret itself is deleted. Move theAWSCURRENTstaging label before or after deleting this resource from this provider to fully trigger version deprecation if necessary.
Example Usage
Simple String Value
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.SecretsManager.SecretVersion("example", new Aws.SecretsManager.SecretVersionArgs
{
SecretId = aws_secretsmanager_secret.Example.Id,
SecretString = "example-string-to-protect",
});
}
}
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.NewSecretVersion(ctx, "example", &secretsmanager.SecretVersionArgs{
SecretId: pulumi.String(aws_secretsmanager_secret.Example.Id),
SecretString: pulumi.String("example-string-to-protect"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.secretsmanager.SecretVersion("example",
secret_id=aws_secretsmanager_secret["example"]["id"],
secret_string="example-string-to-protect")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.secretsmanager.SecretVersion("example", {
secretId: aws_secretsmanager_secret_example.id,
secretString: "example-string-to-protect",
});Key-Value Pairs
Coming soon!
Coming soon!
Coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
// The map here can come from other supported configurations
// like locals, resource attribute, map() built-in, etc.
const example = config.get("example") || {
key1: "value1",
key2: "value2",
};
const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
secretId: aws_secretsmanager_secret_example.id,
secretString: (() => {
throw "tf2pulumi error: NYI: call to jsonencode";
return (() => { throw "NYI: call to jsonencode"; })();
})(),
});Create a SecretVersion Resource
new SecretVersion(name: string, args: SecretVersionArgs, opts?: CustomResourceOptions);def SecretVersion(resource_name, opts=None, secret_binary=None, secret_id=None, secret_string=None, version_stages=None, __props__=None);func NewSecretVersion(ctx *Context, name string, args SecretVersionArgs, opts ...ResourceOption) (*SecretVersion, error)public SecretVersion(string name, SecretVersionArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SecretVersionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SecretVersionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecretVersionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
SecretVersion Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The SecretVersion resource accepts the following input properties:
- Secret
Id string Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- Secret
Binary string Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- Secret
String string Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- Version
Stages List<string> Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
- Secret
Id string Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- Secret
Binary string Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- Secret
String string Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- Version
Stages []string Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
- secret
Id string Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- secret
Binary string Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- secret
String string Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- version
Stages string[] Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
- secret_
id str Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- secret_
binary str Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- secret_
string str Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- version_
stages List[str] Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
Outputs
All input properties are implicitly available as output properties. Additionally, the SecretVersion resource produces the following output properties:
Look up an Existing SecretVersion Resource
Get an existing SecretVersion resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SecretVersionState, opts?: CustomResourceOptions): SecretVersionstatic get(resource_name, id, opts=None, arn=None, secret_binary=None, secret_id=None, secret_string=None, version_id=None, version_stages=None, __props__=None);func GetSecretVersion(ctx *Context, name string, id IDInput, state *SecretVersionState, opts ...ResourceOption) (*SecretVersion, error)public static SecretVersion Get(string name, Input<string> id, SecretVersionState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Arn string
The ARN of the secret.
- Secret
Binary string Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- Secret
Id string Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- Secret
String string Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- Version
Id string The unique identifier of the version of the secret.
- Version
Stages List<string> Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
- Arn string
The ARN of the secret.
- Secret
Binary string Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- Secret
Id string Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- Secret
String string Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- Version
Id string The unique identifier of the version of the secret.
- Version
Stages []string Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
- arn string
The ARN of the secret.
- secret
Binary string Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- secret
Id string Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- secret
String string Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- version
Id string The unique identifier of the version of the secret.
- version
Stages string[] Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
- arn str
The ARN of the secret.
- secret_
binary str Specifies binary data that you want to encrypt and store in this version of the secret. This is required if secret_string is not set. Needs to be encoded to base64.
- secret_
id str Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.
- secret_
string str Specifies text data that you want to encrypt and store in this version of the secret. This is required if secret_binary is not set.
- version_
id str The unique identifier of the version of the secret.
- version_
stages List[str] Specifies a list of staging labels that are attached to this version of the secret. A staging label must be unique to a single version of the secret. If you specify a staging label that’s already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value, then AWS Secrets Manager automatically moves the staging label
AWSCURRENTto this new version on creation.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.