Repository navigation
feat(terraform): dismiss approvals when the plan changes - #399
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joscdk
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in
dismiss-stale-approvalsinput toterraform-stack.yml. With it on, an approval covers a plan rather than a commit. This came out of the discussion on monta-app/terraform#461 (Zipper): a PR approved on a harmless plan can pick up a mass replacement from a rebase, and then gets merged and applied without anyone looking.How it works (pull requests only):
terraform show -json→ a sha256 overresource_changes, minus no-op and read. The hash covers address, actions,after(sensitive values masked as(sensitive)),after_unknown,replace_pathsandimporting. Resource order doesn't matter, and drift outside the PR (resource_drift) is left out.<!-- terraform-plan-fingerprint:<sha>:<hash> -->, keeping the last 50.APPROVEDis checked against the fingerprint recorded for its commit. If it differs, or no plan was recorded for that commit, the approval is dismissed with a message naming the stack.Behaviour:
Not tested in CI yet. The jq fingerprint was tested locally on sample plans: ordering and masked secrets are ignored, and a changed value changes the hash. The JS passes a syntax check. The first real run will be monta-app/terraform with the input on.
Callers pin by SHA and the input defaults to
false, so nothing changes for other repos.🤖 Generated with Claude Code