Feature request: add hook(s) for cleaning up CF empty changesets
See original GitHub issueDescribe your idea/feature/enhancement
Provide a clear description. Ex. I wish SAM CLI would […]
I wish SAM CLI would provide a sub command (and or transparent option) to have changesets which are ignored do to nothing changes which the user chooses ignore with --no-execute-changeset
to clean up unapplied changesets
I’ve found in a few continuous deployment cases were I have --no-execute-changeset
where I preview deployment with other applying as well as run deploy ignoring empty changesets with fail_on_empty_changeset
set to false but these changesets accumulate and eventually lead to an error when the stack hits a cloud formation limit
I have a work around in the form of a custom script
for name in $(
aws cloudformation list-change-sets --stack-name ${STACK_NAME} --output text --query "Summaries[?StatusReason=='The submitted information didn\'t contain changes. Submit different information to create a change set.'].ChangeSetName"
); do
echo "deleting changeset $name"
aws cloudformation delete-change-set --stack-name ${STACK_NAME} --change-set-name $name;
done
I’d like something like this to be built-in and in the most ideal situations automatically delete an unapplied changeset when an deploy fails do to an empty changeset so I don’t even have to think about it
Proposal
Add details of how to add this to the product.
either add a new subcommand do to this in masse, or an flag deploy
to opt in or just do this automatically. I believe sam already knows when its an empty changeset error ie. the fail_on_empty_changeset
hook.
Things to consider:
- Will this require any updates to the SAM Spec
nope
Additional Details
Issue Analytics
- State:
- Created a year ago
- Comments:9 (6 by maintainers)
@softprops I chatted with the team. Due to the uncertainty and risk of what we could break, the team would prefer in the opt-in way through a command line option or flag with the v1.X scope of SAM CLI. With the
samconfig.toml
, this at least allows customers to specific it (once per project) which lowers some cost. We can also log to console within SAM CLI, to help bring attention. We can then revisit this within a SAM CLI v2 context (whenever that is) to move to your proposal and ideal solution.Are you still willing to contribute a patch for this?
@softprops I agree. It’s probably what we should have done from the beginning but I have some backwards compatibility concerns. Because we don’t know all cases in which a customer may use or want the empty changeset around, adding in this behavior without a customer opt-ing in can be a breaking change to some customers. Most might not care but for those who might, it breaks our compatibility.
So the easiest way forward it to introduce a way for customers to opt into this new behavior. However, I will bring it up with the team, as maybe this one is worth it. If it is, we would really have to dive into if there are cases we would be breaking and try to notify those customers (which is hard).