'Execute CloudFormation even with empty changeset
We have a CloudFormation (yaml in our Git), it's downloading config files from S3 using cfn-hup. When there is a change in the config files on s3 we can't just create a new changeset and execute it because the changeSet is empty. CloudFormation isn't seeing the changes in the config files on S3 of course. How can we workaround this?
Solution 1:[1]
One workaround that I just tested that it works has two components:
A dummy template parameter which you can change each time you want to change your Init section. Meaning each time you get new config file in s3, e.g.:
ConfigUpdateRequired:
Type: String
Default: some-value
Description: Change me when a config changes
A dummy file, or env variable, in the Init section referencing the parameter, e.g.:
files:
/tmp/dummyfile:
content: !Sub "${ConfigUpdateRequired}"
Each time you want to update your config file, you modify the ConfigUpdateRequired parameter. This will modify the /tmp/dummyfile. cfn-hup will then detect changes and will update.
Obviously all this process can be automated by means of CodePipline, or any thing that could trigger an update of your stack when the config file in S3 changes and set some new value of ConfigUpdateRequired.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marcin |
