pre-commit-terraform
pre-commit-terraform copied to clipboard
feat: New Python-based `terraform_fmt` hook to better support Windows
Put an x
into the box if that apply:
- [ ] This PR introduces breaking change.
- [ ] This PR fixes a bug.
- [x] This PR adds new functionality.
- [x] This PR enhances existing functionality.
Description of your changes
Fixes #648
How can we test changes
From a windows PowerShell or cmd.exe (i.e. outside of Git Bash, or any other Bash) in a repo with a terraform_fmt
hook, run pre-commit run -a
and it will fail with something like /bin/bash: .... : No such file or directory
.
Change the hook from terraform_fmt
to terraform_fmt_v2
and it'll work.
I've tested on Linux and Windows. I've made formatting changes to terraform code and verified that it updates the files in place properly. I have verified that with --args=-check
the files are not updated and the hook fails as expected while showing on stdout the offending files.