[PR #1756/c535e630 backport][stable-8] Create droppath option in ssm_parameter.py #2274
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #1756 as merged into main (c535e63).
SUMMARY
In the event that there exists two parameters in Parameter Store
path/to/params/foo/bar/param
andpath/to/params/x/y/param
, a user attempting to recursively pull all parameters under thepath/to/params
path with the command{{ lookup('amazon.aws.aws_ssm', '/PATH/to/params', region='ap-southeast-2', shortnames=true, bypath=true, recursive=true ) }}"
will be unable to use theshortnames
argument without creating a conflict between the twoparam
results. Only oneparam
key will exist in the resulting dictionary.This is problematic for users that wish to lookup a parameter hierarchy with repetitive names in the final value of the parameter path. In this scenario, users are currently forced to use the fully qualified parameter name when interacting with their dictionary results.
This pull request introduces the droppath option, which will drop the common lookup path from the names of all parameters. In the scenario above, the resulting dictionary would contain both a
foo/bar/param
and a/x/y/param
allowing users to refer to them by their minimally differentiated name.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
Step by step
Setup
Run shortnames
debug: msg="{{ lookup('amazon.aws.aws_ssm', '/PATH/to/params', region='ap-southeast-2', shortnames=true, bypath=true, recursive=true ) }}"
{'param': '123'}
Run droppath
debug: msg="{{ lookup('amazon.aws.aws_ssm', '/PATH/to/params', region='ap-southeast-2', droppath=true, bypath=true, recursive=true ) }}"
{'/foo/bar/param': 'abc', '/x/y/param': '123'}
Run both
debug: msg="{{ lookup('amazon.aws.aws_ssm', '/PATH/to/params', region='ap-southeast-2', droppath=true, shortnames = true, bypath=true, recursive=true ) }}"
shortnames and droppath are mutually exclusive. They cannot both be set to true.