You should add pre-commits to your terraform repositories to have a higher minimum quality over your commits.
In order to use pre-commit with all recommanded features, you will need to install some tools
-
Install the
pre-commit
toolpip install pre-commit
-
Install the git hook scripts
pre-commit install
-
Copy the
.pre-commit-config.yaml
file at the root of your repository
Pre-commit will only check files pending for commit.
```bash
# With one file
git add myfile.tf
git commit # will trigger pre-commit scripts
# To trigger it manually
pre-commit
# Run on all changed files
pre-commit run -a
```
Run pre-commit autoupdate
in order to bump pre-commit repositories tag versions