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
        {
            RotationLambdaArn = aws_lambda_function.Example.Arn,
            RotationRules = new Aws.SecretsManager.Inputs.SecretRotationRotationRulesArgs
            {
                AutomaticallyAfterDays = 30,
            },
            SecretId = 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.NewSecretRotation(ctx, "example", &secretsmanager.SecretRotationArgs{
            RotationLambdaArn: pulumi.String(aws_lambda_function.Example.Arn),
            RotationRules: &secretsmanager.SecretRotationRotationRulesArgs{
                AutomaticallyAfterDays: pulumi.Int(30),
            },
            SecretId: pulumi.String(aws_secretsmanager_secret.Example.Id),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example = aws.secretsmanager.SecretRotation("example",
    rotation_lambda_arn=aws_lambda_function["example"]["arn"],
    rotation_rules={
        "automaticallyAfterDays": 30,
    },
    secret_id=aws_secretsmanager_secret["example"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.secretsmanager.SecretRotation("example", {
    rotationLambdaArn: aws_lambda_function_example.arn,
    rotationRules: {
        automaticallyAfterDays: 30,
    },
    secretId: aws_secretsmanager_secret_example.id,
});

Create a SecretRotation Resource

def SecretRotation(resource_name, opts=None, rotation_lambda_arn=None, rotation_rules=None, secret_id=None, tags=None, __props__=None);
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.
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 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.

SecretRotation Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The SecretRotation resource accepts the following input properties:

RotationLambdaArn string

Specifies the ARN of the Lambda function that can rotate the secret.

RotationRules SecretRotationRotationRulesArgs

A structure that defines the rotation configuration for this secret. Defined below.

SecretId 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.

Tags Dictionary<string, string>
RotationLambdaArn string

Specifies the ARN of the Lambda function that can rotate the secret.

RotationRules SecretRotationRotationRules

A structure that defines the rotation configuration for this secret. Defined below.

SecretId 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.

Tags map[string]string
rotationLambdaArn string

Specifies the ARN of the Lambda function that can rotate the secret.

rotationRules SecretRotationRotationRules

A structure that defines the rotation configuration for this secret. Defined below.

secretId 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.

tags {[key: string]: string}
rotation_lambda_arn str

Specifies the ARN of the Lambda function that can rotate the secret.

rotation_rules Dict[SecretRotationRotationRules]

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.

tags Dict[str, str]

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.
RotationEnabled bool

Specifies whether automatic rotation is enabled for this secret.

Id string
The provider-assigned unique ID for this managed resource.
RotationEnabled bool

Specifies whether automatic rotation is enabled for this secret.

id string
The provider-assigned unique ID for this managed resource.
rotationEnabled 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.

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
static get(resource_name, id, opts=None, rotation_enabled=None, rotation_lambda_arn=None, rotation_rules=None, secret_id=None, tags=None, __props__=None);
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)
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:

RotationEnabled bool

Specifies whether automatic rotation is enabled for this secret.

RotationLambdaArn string

Specifies the ARN of the Lambda function that can rotate the secret.

RotationRules SecretRotationRotationRulesArgs

A structure that defines the rotation configuration for this secret. Defined below.

SecretId 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.

Tags Dictionary<string, string>
RotationEnabled bool

Specifies whether automatic rotation is enabled for this secret.

RotationLambdaArn string

Specifies the ARN of the Lambda function that can rotate the secret.

RotationRules SecretRotationRotationRules

A structure that defines the rotation configuration for this secret. Defined below.

SecretId 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.

Tags map[string]string
rotationEnabled boolean

Specifies whether automatic rotation is enabled for this secret.

rotationLambdaArn string

Specifies the ARN of the Lambda function that can rotate the secret.

rotationRules SecretRotationRotationRules

A structure that defines the rotation configuration for this secret. Defined below.

secretId 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.

tags {[key: string]: string}
rotation_enabled bool

Specifies whether automatic rotation is enabled for this secret.

rotation_lambda_arn str

Specifies the ARN of the Lambda function that can rotate the secret.

rotation_rules Dict[SecretRotationRotationRules]

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.

tags Dict[str, str]

Supporting Types

SecretRotationRotationRules

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

AutomaticallyAfterDays int

Specifies the number of days between automatic scheduled rotations of the secret.

AutomaticallyAfterDays int

Specifies the number of days between automatic scheduled rotations of the secret.

automaticallyAfterDays number

Specifies the number of days between automatic scheduled rotations of the secret.

automaticallyAfterDays float

Specifies the number of days between automatic scheduled rotations of the secret.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.