@@ -177,6 +177,8 @@ function select-release-version () {
177
177
}
178
178
179
179
function cf-parameters () {
180
+ # If we rename or delete parameters from the CF template, do not remove them from this list,
181
+ # logic below keeps this list backward-compatible for older CF templates
180
182
CF_PARAMETERS=$( cat << EOF
181
183
[
182
184
{
@@ -210,6 +212,11 @@ function cf-parameters () {
210
212
]
211
213
EOF
212
214
)
215
+
216
+ TEMPLATE_PARAMETER_KEYS=$( echo " $MAIN_TEMPLATE " | jq -r ' .Parameters | [keys[]]' )
217
+
218
+ # For backward-compatibility remove any CF_PARAMETERS that don't exist in the MAIN_TEMPLATE that has been selected
219
+ CF_PARAMETERS=$( echo " $CF_PARAMETERS " | jq --argjson tpk " $TEMPLATE_PARAMETER_KEYS " -r ' [.[] | select( .[] as $in | $tpk | index($in))]' )
213
220
}
214
221
215
222
function wait-for-stack () {
@@ -270,13 +277,13 @@ EOF
270
277
ZIP_FILE=" autotag-$MANAGE_RELEASE_VERSION .zip"
271
278
S3_PATH=" releases/$ZIP_FILE "
272
279
280
+ # TODO: this doesn't work before v0.5.1 because the JSON template wasn't in the repo
281
+ MAIN_TEMPLATE=$( curl -sS ${GITHUB_URL} /${RELEASE_COMMIT} /cloud_formation/event_multi_region_template/autotag_event_main-template.json)
282
+
273
283
echo " Creating the Main CloudFormation Stack..."
274
284
275
285
cf-parameters
276
286
277
- # TODO: this doesn't work before v0.5.1 because the template wasn't in the repo
278
- MAIN_TEMPLATE=$( curl -sS ${GITHUB_URL} /${RELEASE_COMMIT} /cloud_formation/event_multi_region_template/autotag_event_main-template.json)
279
-
280
287
aws cloudformation create-stack \
281
288
$AWS_CREDENTIALS \
282
289
--template-body " $MAIN_TEMPLATE " \
753
760
S3_AWS_CREDENTIALS=" $AWS_CREDENTIALS "
754
761
fi
755
762
756
- # defaults
763
+ # CF template defaults
757
764
[ -z " $LOG_RETENTION_DAYS " ] && export LOG_RETENTION_DAYS=90
758
765
[ -z " $LOG_LEVEL_DEBUG " ] && export LOG_LEVEL_DEBUG=Disabled
759
766
[ -z " $CREATE_TIME " ] && export CREATE_TIME=Enabled
0 commit comments