Skip to content

INFRA-2970: fix: show diff in terraform fmt CI check - #11

Open
scrubious wants to merge 1 commit into
mainfrom
infra-2970-terraform-fmt-show-diff-in-ci
Open

INFRA-2970: fix: show diff in terraform fmt CI check#11
scrubious wants to merge 1 commit into
mainfrom
infra-2970-terraform-fmt-show-diff-in-ci

Conversation

@scrubious

Copy link
Copy Markdown
Contributor

Summary

  • Add -diff flag to terraform fmt -check -recursive in the analysis workflow

Previously a fmt failure only printed the affected file names plus exit code 3, giving no indication of what was wrong without running terraform fmt locally. With -diff, CI prints the full unified diff for every unformatted block — same signal you'd get from git diff after running fmt.

Before

Run terraform fmt -check -recursive
examples/nodejs-demo-int/main.tf
modules/data-plane/elasticache-serverless/main.tf
Error: Terraform exited with code 3.

After

Run terraform fmt -check -diff -recursive
--- old/modules/data-plane/elasticache-serverless/main.tf
+++ new/modules/data-plane/elasticache-serverless/main.tf
@@ -51,7 +51,6 @@
   lifecycle {
     precondition {
-      condition     = ...
+      condition = ...
     }
   }

…formatting

Previously the fmt step only printed the file names with exit code 3,
leaving no indication of what was wrong without running locally.
-diff prints the full unified diff for every unformatted block.
@scrubious
scrubious marked this pull request as ready for review August 1, 2026 21:33
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.

1 participant