Hey everyone! What are the best Pre Commit / Git H...
# terraform
w
Hey everyone! What are the best Pre Commit / Git Hooks you have implemented for Terraform / OpenTofu?
j
pretty vanilla tflint, tfupdate, and _fmt, you can have a look in our open platform implementation https://github.com/likvid-bank/likvid-cloudfoundation/blob/main/.pre-commit-config.yaml
w
Thank you! I don't use tfupdate so this is very helpful 🙏
w
I like the tflint suggestion. It's brought up worthwhile changes before committing. In a terraform module template we created, we use trunk to run the following linters. Trunk has the option of also managing the git pre-commit hooks for you.
Copy code
- renovate@40.36.2
- tofu@1.9.1
- actionlint@1.7.7
- checkov@3.2.435
- git-diff-check
- markdownlint@0.45.0
- prettier@3.5.3
- tflint@0.58.0
- trivy@0.63.0
- trufflehog@3.88.35
- yamllint@1.37.1

# FYI - formatting is a yaml list
# See full context here, <https://github.com/masterpointio/terraform-module-template/blob/main/.trunk/trunk.yaml#L23-L33>