pre-commit icon indicating copy to clipboard operation
pre-commit copied to clipboard

terraform-fmt updates files, optionally skipped via flags

Open tyron opened this issue 3 years ago • 11 comments

Restore terraform-fmt behaviour from v0.1.11. Fixes #48.

By default, changes are written back to source files as usual for pre-commit hooks, but can be optionally disabled by providing a --no-autofix flag to terraform-fmt.

tyron avatar Aug 09 '21 19:08 tyron

@brikis98 , @yorinasub17 please let me know if this is OK to be reviewed, or if you'd prefer that we don't revert the default behaviour -- rather just expose the flag to switch to the old one.

tyron avatar Aug 15 '21 23:08 tyron

Any movement on this? Seems a few folks would like old behavior

joshmyers avatar Feb 10 '22 16:02 joshmyers

Just my 2cents:

I thought with 1.1.17 this would have been fixed by now. Because it is not, I will still continue using 0.1.11 for auto format files.

mleuthold avatar Feb 11 '22 15:02 mleuthold

+1 on this change. Printing the diff is not as useful as auto-correcting the styling.

ysawa0 avatar Mar 22 '22 20:03 ysawa0

Is there anything what I can do to make that change happen?

ad-m-ss avatar Mar 31 '22 01:03 ad-m-ss

If anyone interested that change can be easily tested eg. via:

- repo: https://github.com/gruntwork-io/pre-commit
  rev: 837cfa83f27ec2dd4a4c6860b2a6ca9392642fe0
  hooks:
    - id: terraform-fmt
    - id: terraform-validate
      exclude: terragrunt/modules

ad-m-ss avatar Mar 31 '22 01:03 ad-m-ss

while this is not complete its better then the current fuctionality

sanguis avatar Jun 14 '22 13:06 sanguis

Can we get some traction on this. The previous functionality is much nicer.

ayk33 avatar Sep 26 '22 19:09 ayk33

Also waiting on this functionality

Fez29 avatar Jan 04 '23 08:01 Fez29

Would be good to see this functionality

Tlunch avatar Feb 26 '24 15:02 Tlunch