I want to create a SecretsManager secret with two values both generated on the fly. Is that possible and how do I do it?
For example, if I wanted the final secret to look like this in JSON, what would the CloudFormation yaml look like?
{
"password": "<Generated Value>",
"serviceId": "fd07f2ab-96bd-4c5c-a4a9-9b8c43b666d7",
"login": "<Different Generated Value>"
}
If this is part of a CF template that generates the password part of the secret string, how would I generate a dynamic 'login' field as well?
#This is a Secret resource with a randomly generated password in its SecretString JSON.
MySecretA:
Type: 'AWS::SecretsManager::Secret'
Properties:
Name: MySecretForAppA
Description: "This secret has a dynamically generated secret password and login."
GenerateSecretString:
SecretStringTemplate: '{"service-id": "<some guid>"}'
GenerateStringKey: "password"
PasswordLength: 30
ExcludeCharacters: '"@/\'