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

Add an optional ImageId SSM Parameter Path #691

Merged
merged 4 commits into from
Jul 8, 2020

Conversation

keithduncan
Copy link
Contributor

This adds an optional String parameter to the elastic-ci stack parameter list. If given this is expected to be an SSM Parameter Path. This cannot be typed as an AWS::SSM::Parameter at the top level because that would make it mandatory. Instead, if given, a substack with a AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> parameter is brought in whose output is the value we need.

Example error when using an AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> parameter with a Default: "":

Error: Failed to create changeset for the stack: substack-laundry, An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameter AmiParameterPath should either have input value or default value

This change removes the UseDefaultAMI condition and replaces it with HasImageId and HasImageIdParameter conditions. Precedence is: the plain ImageId parameter, the SSM parameter path, then the default AMI mapping.

The given TemplateURL I’ve used here won’t work because it’s file system relative and we don’t use aws cloudformation package to preprocess the template. We’ll either need to add something to the build system to make this work, or pre-deploy the new template somewhere we can reference with an S3 url. I don’t anticipate this substack template changing often and would lean towards separately packaging and deploying the ssm-ami.yml template to S3, and using a static semver'd URL to this template in the main aws-stack.yml file. This would avoid any potentially complex additions to the current build system.

Copy link
Contributor

@chloeruka chloeruka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for setting this up.

@keithduncan keithduncan requested a review from chloeruka July 8, 2020 02:25
@keithduncan keithduncan merged commit be63681 into stable-4-4 Jul 8, 2020
@keithduncan keithduncan deleted the add-ssm-ami-parameter branch July 8, 2020 05:15
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.

3 participants