🚀 Enhancements
fix: CI job summary shows NO_CHANGE badge for output-only Terraform changes @osterman (#2306)
## what- When Terraform plan detects only output changes (exit code 2), the CI job summary now correctly distinguishes this from "no changes" and "resource changes"
- Added a new blue
OUTPUT_CHANGEbadge for output-only plans/applies, distinct from the grayNO_CHANGEbadge and the resource-levelCREATE/CHANGE/REPLACE/DESTROYbadges - Template headings now differentiate: "Resource Changes Found" vs "Output Changes Found" vs "No Changes"
- Plan detail summary shows "Output values will change. No infrastructure changes." for output-only changes
why
- Terraform exits with code 2 when there are changes, including output-only changes (no infrastructure modifications). The existing
HasChanges()method only checked resource counts, so output-only changes were incorrectly reported as "NO_CHANGE" in CI job summaries. This was misleading because Terraform considers these real changes that need to be applied. - Making the distinction between resource changes and output-only changes explicit helps CI users understand at a glance whether infrastructure will be modified or just state outputs will be updated.
references
- Terraform plan exit codes: 0 = no changes, 1 = error, 2 = changes detected (includes output-only changes)
Summary by CodeRabbit
-
New Features
- Detect and report Terraform output-only changes with distinct "Output Changes Found" / "Output Changes Applied" messaging.
-
Improvements
- Separate resource vs output-only summaries, badges, and details for clearer plan/apply results.
- Revised workspace handling to prefer selection before creation and improved handling of missing state files on Windows.
- Added utilities to clear Terraform caches to reduce stale-state issues.
-
Tests
- Added/expanded tests for output-only detection, summaries, workspace behaviors, and cache isolation.
-
Documentation
- Updated templates and fixtures to reflect new messaging.