User Tools

Site Tools


bloglike:2022-02

Issue 2022 - February

Beware of AWS CloudFormation Parameter defaults

You might want to parametrize AWS CloudFormation stacks, either because things change over time and you want Stack to be a bit dynamic, or because one “variable” is used multiple times and it's a good practice not to repeat yourself and better to change it just in one place. Since this is a fresh Stack, you know what value of that “variable” is, therefore you'll go for something like this:

Parameters:
  MyParameter:
    Type: String
    Description: "This parameter sets something useful."
    Default: "default-value-is-42"

Resources:
  MyResource:
    Type: AWS::SomeResourceType
    SomeResParameter: !Ref MyParameter

One week later, you decide that default-value-is-42 is not good enough and you will change it to new-default-value. You deploy your Stack, check whether changes took place and … nothing. Unfortunately, changing default value of input Parameter is not picked up by AWS CloudFormation and will result in no-op. This sucks especially in case of AWS Elastic Beanstalk's .ebextensions and the only solution seems to be not to use parameters, but to either repeat yourself or turn them into eg. jinja2 templates.

Zdenek Styblik 2022/02/25 09:31

bloglike/2022-02.txt · Last modified: 2022/02/25 03:33 by stybla