I am trying to take username and password from user as input parameters and create the secret in secret manager.
Using ${Username} doesnt seem to replace and could not find a documentation on how to go about this. Is it even supported? if not, any recommended workarounds?
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MySecret:
Type: 'AWS::SecretsManager::Secret'
Properties:
Description: 'My example secret'
GenerateSecretString:
SecretStringTemplate: '{"username": "${Username}", "password": "${Password}"}'
PasswordLength: 16
ExcludePunctuation: true
Tags:
- Key: 'Name'
Value: 'MySecret'
Parameters:
Username:
Type: String
Description: 'Username for the secret'
Password:
Type: String
Description: 'Password for the secret'
You may have wanted
SecretStringinstead ofGenerateSecretString.The
GenerateSecretStringproperty generates random passwords for you. The template lets you specify text that contains the password, but not the password itself. If you specifySecretStringTemplate, you also need to provideGenerateStringKey.This template:
Creates a secret that looks like this:
{"password":"q0*99P1dd46@_K*zW#pA+nK5fhkqA!/u","username":"admin"}