Skip to content

fix(terraform): count imports in plan summary, list destroys above the fold - #397

Merged
tobias0106 merged 1 commit into
mainfrom
terraform-plan-summary-imports
Nov 2, 2026
Merged

tobias0106 merged 1 commit into
mainfrom
terraform-plan-summary-imports

Conversation

@tobias0106

Copy link
Copy Markdown
Contributor

Why

On monta-app/terraform-core#286 the plan comment said only Changes planned. It hid that accounts/internal/iam destroys module.users.aws_iam_policy.clickpipes.

The cause wasn't the plan length. The summary regex only matched Plan: N to add, N to change, N to destroy., and Terraform prints Plan: N to import, ... when the plan has imports. So every plan with an import lost its counts.

What

  • The summary regex accepts the optional N to import, part, and the summary shows 🔵 import / 🟢 add / 🟡 change / 🔴 destroy. Counts are read from the full plan.txt, so they survive truncation.
  • A [!CAUTION] block outside the collapsed plan lists every address that will be destroyed or must be replaced.
  • The commented plan drops Refreshing state... / Reading... / Read complete / Preparing import... lines, so the 60k limit is spent on the diff. On feat: add FARO_API_KEY build secret for source-map upload #286 that cuts ~146k chars down to ~100k.

Tested the regexes against the #286 run log: they give 2/0/1/1 and 17/0/10/0, and find the one destroy.

After merge, bump the pinned SHA in terraform-core .github/workflows/terraform.yml (and any other callers).

🤖 Generated with Claude Code

…bove the fold

The summary regex never matched 'Plan: N to import, ...', so any plan with
imports fell back to 'Changes planned' and hid its destroy count. Also lists
destroyed/replaced addresses outside the collapsed plan and drops refresh
noise from the commented plan so less of it gets truncated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tobias0106
tobias0106 marked this pull request as ready for review November 2, 2026 14:19
@tobias0106
tobias0106 requested a review from a team as a code owner November 2, 2026 14:19
@tobias0106
tobias0106 requested review from gh05tdog and removed request for a team November 2, 2026 14:19
@tobias0106
tobias0106 merged commit 7e6f5b5 into main Nov 2, 2026
1 check passed
@tobias0106
tobias0106 deleted the terraform-plan-summary-imports branch November 2, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants