-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IT-3860: Pass secure parameter to automation script #1259
Conversation
…on instances tagged appropriately
for more information, see https://pre-commit.ci
…ompatible with SSM Automation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
envVarName=envParamNamePair[0] | ||
ssmParamName=envParamNamePair[1] | ||
envVarValue = client.get_parameter(Name=ssmParamName, WithDecryption=True)['Parameter']['Value'] | ||
keyValuePair=envVarName+":"+envVarValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if envVarValue
returns None or empty? should we check for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so then the script will get a blank value for the given env var. That will only happen if someone enters an empty value in SSM Parameter Store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if they forget to define the parameter in the AWS SSM? or they define it with an parameter name that doesn't match the one that's passed in to these templates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case line 196 will raise an exception, i.e., get_parameter
will fail.
While CloudFormation allows invoking SSM Parameter look up when passing parameters , Organization Formation fails with the error:
The fix is instead to simply pass the SSM Parameter name to the Automation script and update the Lambda to retrieve the secure parameter(s) to pass to the Automation Document.
This PR also updates the documentation to explain how to use the script.