AWS Classic
SecretRotation
Provides a resource to manage AWS Secrets Manager secret rotation. To manage a secret, see the aws.secretsmanager.Secret
resource. To manage a secret value, see the aws.secretsmanager.SecretVersion
resource.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.SecretsManager.SecretRotation("example", new Aws.SecretsManager.SecretRotationArgs
{
SecretId = aws_secretsmanager_secret.Example.Id,
RotationLambdaArn = aws_lambda_function.Example.Arn,
RotationRules = new Aws.SecretsManager.Inputs.SecretRotationRotationRulesArgs
{
AutomaticallyAfterDays = 30,
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := secretsmanager.NewSecretRotation(ctx, "example", &secretsmanager.SecretRotationArgs{
SecretId: pulumi.Any(aws_secretsmanager_secret.Example.Id),
RotationLambdaArn: pulumi.Any(aws_lambda_function.Example.Arn),
RotationRules: &secretsmanager.SecretRotationRotationRulesArgs{
AutomaticallyAfterDays: pulumi.Int(30),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new SecretRotation("example", SecretRotationArgs.builder()
.secretId(aws_secretsmanager_secret.example().id())
.rotationLambdaArn(aws_lambda_function.example().arn())
.rotationRules(SecretRotationRotationRulesArgs.builder()
.automaticallyAfterDays(30)
.build())
.build());
}
}
import pulumi
import pulumi_aws as aws
example = aws.secretsmanager.SecretRotation("example",
secret_id=aws_secretsmanager_secret["example"]["id"],
rotation_lambda_arn=aws_lambda_function["example"]["arn"],
rotation_rules=aws.secretsmanager.SecretRotationRotationRulesArgs(
automatically_after_days=30,
))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.secretsmanager.SecretRotation("example", {
secretId: aws_secretsmanager_secret.example.id,
rotationLambdaArn: aws_lambda_function.example.arn,
rotationRules: {
automaticallyAfterDays: 30,
},
});
resources:
example:
type: aws:secretsmanager:SecretRotation
properties:
secretId: ${aws_secretsmanager_secret.example.id}
rotationLambdaArn: ${aws_lambda_function.example.arn}
rotationRules:
automaticallyAfterDays: 30
Create a SecretRotation Resource
new SecretRotation(name: string, args: SecretRotationArgs, opts?: CustomResourceOptions);
@overload
def SecretRotation(resource_name: str,
opts: Optional[ResourceOptions] = None,
rotation_lambda_arn: Optional[str] = None,
rotation_rules: Optional[SecretRotationRotationRulesArgs] = None,
secret_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None)
@overload
def SecretRotation(resource_name: str,
args: SecretRotationArgs,
opts: Optional[ResourceOptions] = None)
func NewSecretRotation(ctx *Context, name string, args SecretRotationArgs, opts ...ResourceOption) (*SecretRotation, error)
public SecretRotation(string name, SecretRotationArgs args, CustomResourceOptions? opts = null)
public SecretRotation(String name, SecretRotationArgs args)
public SecretRotation(String name, SecretRotationArgs args, CustomResourceOptions options)
type: aws:secretsmanager:SecretRotation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecretRotationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SecretRotationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SecretRotationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecretRotationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecretRotationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
SecretRotation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The SecretRotation resource accepts the following input properties:
- Rotation
Lambda stringArn Specifies the ARN of the Lambda function that can rotate the secret.
- Rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Dictionary<string, string>
- Rotation
Lambda stringArn Specifies the ARN of the Lambda function that can rotate the secret.
- Rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- map[string]string
- rotation
Lambda StringArn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Map<String,String>
- rotation
Lambda stringArn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- {[key: string]: string}
- rotation_
lambda_ strarn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation_
rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Mapping[str, str]
- rotation
Lambda StringArn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation
Rules Property Map A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Map<String>
Outputs
All input properties are implicitly available as output properties. Additionally, the SecretRotation resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Rotation
Enabled bool Specifies whether automatic rotation is enabled for this secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Rotation
Enabled bool Specifies whether automatic rotation is enabled for this secret.
- id String
The provider-assigned unique ID for this managed resource.
- rotation
Enabled Boolean Specifies whether automatic rotation is enabled for this secret.
- id string
The provider-assigned unique ID for this managed resource.
- rotation
Enabled boolean Specifies whether automatic rotation is enabled for this secret.
- id str
The provider-assigned unique ID for this managed resource.
- rotation_
enabled bool Specifies whether automatic rotation is enabled for this secret.
- id String
The provider-assigned unique ID for this managed resource.
- rotation
Enabled Boolean Specifies whether automatic rotation is enabled for this secret.
Look up an Existing SecretRotation Resource
Get an existing SecretRotation 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?: SecretRotationState, opts?: CustomResourceOptions): SecretRotation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
rotation_enabled: Optional[bool] = None,
rotation_lambda_arn: Optional[str] = None,
rotation_rules: Optional[SecretRotationRotationRulesArgs] = None,
secret_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None) -> SecretRotation
func GetSecretRotation(ctx *Context, name string, id IDInput, state *SecretRotationState, opts ...ResourceOption) (*SecretRotation, error)
public static SecretRotation Get(string name, Input<string> id, SecretRotationState? state, CustomResourceOptions? opts = null)
public static SecretRotation get(String name, Output<String> id, SecretRotationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Rotation
Enabled bool Specifies whether automatic rotation is enabled for this secret.
- Rotation
Lambda stringArn Specifies the ARN of the Lambda function that can rotate the secret.
- Rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Dictionary<string, string>
- Rotation
Enabled bool Specifies whether automatic rotation is enabled for this secret.
- Rotation
Lambda stringArn Specifies the ARN of the Lambda function that can rotate the secret.
- Rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- map[string]string
- rotation
Enabled Boolean Specifies whether automatic rotation is enabled for this secret.
- rotation
Lambda StringArn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Map<String,String>
- rotation
Enabled boolean Specifies whether automatic rotation is enabled for this secret.
- rotation
Lambda stringArn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation
Rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- {[key: string]: string}
- rotation_
enabled bool Specifies whether automatic rotation is enabled for this secret.
- rotation_
lambda_ strarn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation_
rules SecretRotation Rotation Rules Args A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Mapping[str, str]
- rotation
Enabled Boolean Specifies whether automatic rotation is enabled for this secret.
- rotation
Lambda StringArn Specifies the ARN of the Lambda function that can rotate the secret.
- rotation
Rules Property Map A structure that defines the rotation configuration for this secret. Defined below.
- 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.
- Map<String>
Supporting Types
SecretRotationRotationRules
- Automatically
After intDays Specifies the number of days between automatic scheduled rotations of the secret.
- Automatically
After intDays Specifies the number of days between automatic scheduled rotations of the secret.
- automatically
After IntegerDays Specifies the number of days between automatic scheduled rotations of the secret.
- automatically
After numberDays Specifies the number of days between automatic scheduled rotations of the secret.
- automatically_
after_ intdays Specifies the number of days between automatic scheduled rotations of the secret.
- automatically
After NumberDays Specifies the number of days between automatic scheduled rotations of the secret.
Import
aws_secretsmanager_secret_rotation
can be imported by using the secret Amazon Resource Name (ARN), e.g.,
$ pulumi import aws:secretsmanager/secretRotation:SecretRotation example arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.