aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

AWS::SecretsManager::Secret GenerateSecretString - Allow flexibility for the SecretStringTemplate definition

Open
#882 0 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

## 1. Title
AWS::SecretsManager::Secret GenerateSecretString - Allow flexibility for the SecretStringTemplate definition

## 2. Scope of request

Currently, the [SecretStringTemplate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-secretsmanager-secret-generatesecretstring.html#cfn-secretsmanager-secret-generatesecretstring-secretstringtemplate) parameter allows you to define a JSON structure where the [GenerateStringKey](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-secretsmanager-secret-generatesecretstring.html#cfn-secretsmanager-secret-generatesecretstring-secretstringtemplate) will be added. Nevertheless, there is **no option for defining where this Key will be injected**. It will be always placed at the root of the JSON. It may be enough for many scenarios, but other use cases that require a more complex JSON structure will not fit here.

As an example, the following snippet
```
TestingSecret:
Type: AWS::SecretsManager::Secret
Properties:
Description: 'This is a testing secret.'
GenerateSecretString:
SecretStringTemplate: !Sub |
{
"SubKey": {
"username": "superuser",
"password": ""
}
}
GenerateStringKey: 'password'
PasswordLength: 18
ExcludeCharacters: '"@/\:;+*'''
```
Will generate the following secret:
```
{
"password": "123456789ABCDEF"
"SubKey": {
"username": "superuser",
"password": ""
}
}
```

## 3. Expected behavior

It would be nice to use the **GenerateStringKey** as a placeholder instead, being able to define exactly where the generated password needs to be replaced. This would leverage the usability of the feature and make it more powerful and generic.

## 4. Suggest specific test cases

N / A

## 5. Helpful Links to speed up research and evaluation

N / A

## 6. Category (required) - Will help with tagging and be easier to find by other users to +1

Use the categories as displayed in the AWS Management Console (simplified):

5. Management (CloudTrail, Config...)

## 7. Any additional context (optional)

N / A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.