AWS Secrets Manager Secret

This page shows how to write Terraform and CloudFormation for Secrets Manager Secret and write them securely.

aws_secretsmanager_secret (Terraform)

The Secret in Secrets Manager can be configured in Terraform with the resource name aws_secretsmanager_secret. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a resource to manage AWS Secrets Manager secret metadata. To manage secret rotation, see the aws_secretsmanager_secret_rotation resource. To manage a secret value, see the aws_secretsmanager_secret_version resource.

AWS::SecretsManager::Secret (CloudFormation)

The Secret in SecretsManager can be configured in CloudFormation with the resource name AWS::SecretsManager::Secret. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Creates a new secret. A secret is a set of credentials, such as a user name and password, that you store in an encrypted form in Secrets Manager. The secret also includes the connection information to access a database or other service, which Secrets Manager doesn't encrypt. A secret in Secrets Manager consists of both the protected secret data and the important information needed to manage the secret.

For information about creating a secret in the console, see Create a secret.

For information about creating a secret using the CLI or SDK, see CreateSecret.

To specify the encrypted value for the secret, you must include either the GenerateSecretString or the SecretString property, but not both. We recommend that you use the GenerateSecretString property to generate a random password as shown in the examples. You can't generate a secret with a SecretBinary secret value using AWS CloudFormation.

Note Do not create a dynamic reference using a backslash (\) as the final value. AWS CloudFormation cannot resolve those references, which causes a resource failure.

Frequently asked questions

What is AWS Secrets Manager Secret?

AWS Secrets Manager Secret is a resource for Secrets Manager of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.