Skip to content

Update terraform-fmt to match terraform-validate #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2020
Merged

Conversation

brikis98
Copy link
Member

@brikis98 brikis98 commented Dec 9, 2020

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.
@brikis98
Copy link
Member Author

Seems to work great! PR updated.

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

@zackproser zackproser left a comment

Choose a reason for hiding this comment

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

LGTM

@brikis98
Copy link
Member Author

Thanks for the review! Merging now.

@brikis98 brikis98 merged commit e9250bd into master Dec 10, 2020
@brikis98 brikis98 deleted the brikis98-patch-1 branch December 10, 2020 16:11
@brikis98
Copy link
Member Author

@ayk33
Copy link

ayk33 commented Jul 9, 2021

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

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 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.

5 participants