Skip to content
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

Merged
merged 26 commits into from
Oct 17, 2024

Conversation

brucehoff
Copy link
Contributor

@brucehoff brucehoff commented Oct 15, 2024

While CloudFormation allows invoking SSM Parameter look up when passing parameters , Organization Formation fails with the error:

SSM Secure reference is not supported in: [AWS::Lambda::Function/Properties/Environment/Variables/ScriptParameters]

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.

brucehoff and others added 23 commits September 24, 2024 15:57
@brucehoff brucehoff requested a review from a team as a code owner October 15, 2024 21:20
envVarName=envParamNamePair[0]
ssmParamName=envParamNamePair[1]
envVarValue = client.get_parameter(Name=ssmParamName, WithDecryption=True)['Parameter']['Value']
keyValuePair=envVarName+":"+envVarValue
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@zaro0508 zaro0508 Oct 16, 2024

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?

Copy link
Contributor Author

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.

@zaro0508 zaro0508 requested a review from a team October 16, 2024 17:13
@brucehoff brucehoff requested a review from zaro0508 October 16, 2024 19:21
@brucehoff brucehoff merged commit 2536fb7 into Sage-Bionetworks-IT:master Oct 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants