Skip to content

Update terraform-fmt to match terraform-validate - #46

Merged
brikis98 merged 2 commits into
masterfrom
brikis98-patch-1
Dec 10, 2020
Merged

Update terraform-fmt to match terraform-validate#46
brikis98 merged 2 commits into
masterfrom
brikis98-patch-1

Conversation

@brikis98

@brikis98brikis98 commented Dec 9, 2020

Copy link
Copy Markdown
Member

This PR updates the terraform-fmt hook as follows:

  1. Run with -diff -check so the differences are printed, rather than made on disk.
  2. Instead of exiting on the first error, save the exit codes, and print out all fmt errors before exiting.

These changes are very similar to #45.

This PR updates the `terraform-fmt` hook as follows:
1. Extract all the directories with Terraform code first and run `terraform fmt` once per directory. 1. Print out the directory where we're running `terraform fmt` to make debugging errors much easier.
1. Instead of exiting on the first error, save the exit codes, and print out all `fmt` errors before exiting.
These changes are very similar to #45.
Comment threadhooks/terraform-fmt.sh Outdated
Co-authored-by: David Alger <davidmalger@gmail.com>
@brikis98

Copy link
Copy Markdown
MemberAuthor

Seems to work great! PR updated.

@zackproser
zackproser self-requested a review December 10, 2020 14:58

@zackproserzackproser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brikis98

Copy link
Copy Markdown
MemberAuthor

Thanks for the review! Merging now.

@brikis98
brikis98 merged commit e9250bd into masterDec 10, 2020
@brikis98
brikis98 deleted the brikis98-patch-1 branch December 10, 2020 16:11
@brikis98

Copy link
Copy Markdown
MemberAuthor

@ayk33

ayk33 commented Jul 9, 2021

Copy link
Copy Markdown

What was the reason for adding -check? It was kind of nice having it automatically format the tf code for you instead of someone manually making the changes that need to be made?

@L1ghtn1ng

Copy link
Copy Markdown

What was the reason for adding -check? It was kind of nice having it automatically format the tf code for you instead of someone manually making the changes that need to be made?

I second this as well

Sign up for freeto 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.

5 participants

@brikis98@ayk33@L1ghtn1ng@davidalger@zackproser