fix(terraform): stop claiming a partial apply when nothing was applied [NOJIRA] - #346
Open
tobias0106 wants to merge 2 commits into
Open
tobias0106 wants to merge 2 commits into
tobias0106 wants to merge 2 commits into
Conversation
…d [NOJIRA] The failure issue asserted "The stack is partially applied" for every failed apply. When Terraform rejects the plan up front - a lock file that drifted, a provider that moved - it changes nothing, and the issue sent the assignee looking for drift that does not exist. It said exactly that on monta-app/terraform#179. Apply output now goes to apply.txt, and the issue reports a partial apply only when Terraform actually started acting on a resource. On any doubt (no apply.txt) it keeps the old wording. set -o pipefail is required: without it tee's exit status masks a failed apply and the step reports success. Also adds the lock-file case to the remediation list, since that is the one that just fired. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tobias0106
requested review from
sudheer-monta
and removed request for
a team
September 16, 2026 14:44
Drops the comment, the const state indirection and four unreachable regex alternations (Creation/Modifications/Destruction/Still only ever print after their -ing line). Same behaviour, 10 fewer lines. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The
terraform-failedissue asserts this unconditionally:That is false whenever Terraform rejects the plan before acting. It said exactly that on monta-app/terraform#179, where
global/clickhouse/productionfailed with:Nothing was applied. The issue still told the assignee the stack was half-changed and would not resolve itself.
Change
Apply output is teed to
apply.txt, and the issue reports a partial apply only when Terraform actually started acting on a resource — it prints one<address>: Creating...line per resource, so the absence of all of them means it never began.The
catchdefaults tostarted = true, so ifapply.txtis missing for any reason the wording is the old, conservative one.set -o pipefailis load-bearing, not tidying: without ittee's exit status masks a failed apply and the step reports success.Also adds the lock-file case to the remediation list, since that is the one that just fired.
Checks
Regex against real output shapes:
YAML parses; the inline script passes
node --check.🤖 Generated with Claude Code