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.
Parameters
-
arnoptional computed - string -
descriptionoptional - string -
idoptional computed - string -
kms_key_idoptional - string -
nameoptional computed - string -
name_prefixoptional computed - string -
policyoptional computed - string -
recovery_window_in_daysoptional - number -
rotation_enabledoptional computed - bool -
rotation_lambda_arnoptional computed - string -
tagsoptional - map from string to string -
rotation_ruleslist block-
automatically_after_daysrequired - number
-
Explanation in Terraform Registry
Provides a resource to manage AWS Secrets Manager secret metadata. To manage secret rotation, see the
aws_secretsmanager_secret_rotationresource. To manage a secret value, see theaws_secretsmanager_secret_versionresource.
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
-
Descriptionoptional - String -
KmsKeyIdoptional - String -
SecretStringoptional - String -
GenerateSecretStringoptional - GenerateSecretString -
ReplicaRegionsoptional - List of ReplicaRegion -
Tagsoptional - List of Tag -
Nameoptional - String
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
GenerateSecretStringor theSecretStringproperty, but not both. We recommend that you use theGenerateSecretStringproperty to generate a random password as shown in the examples. You can't generate a secret with aSecretBinarysecret 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.