question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: add hook(s) for cleaning up CF empty changesets

See original GitHub issue

Describe 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:

  1. Will this require any updates to the SAM Spec

nope

Additional Details

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jfusscommented, Aug 24, 2022

@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?

0reactions
jfusscommented, Aug 18, 2022

@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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proactively keep resources secure and compliant with AWS ...
Cleanup · Disable the hook in your account by changing the hook's configuration property TargetStacks to NONE . · Deregister the hook from...
Read more >
CloudFormation — Boto3 Docs 1.26.32 documentation - AWS
CloudFormation creates and deletes all member resources of the stack ... if no hooks invoke for the resource, or contains the number of...
Read more >
hgrc - selenic consulting
Overriding a site-wide hook can be done by changing its value or setting it to an empty string. Hooks can be prioritized by...
Read more >
Spinnaker Release 1.18.1
Added plugin metadata repository to act as source of truth for installed plugins ... aws/cfn: Add execute CloudFormation ChangeSet (a38fa89f); cf: add SpEL ......
Read more >
man page hg section 1 - manpagez
When this is done, hooks operating on incoming changesets and ... Mercurial has the ability to add new features through the use of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found