After https://github.com/melmorabity/pre-commit-terraform-fmt
A pre-commit hook to rewrite Terraform configuration files to a canonical format.
.pre-commit-config.yaml
:
- repo: git://github.com/jameswoolfenden/pre-commit
rev: 0.0.1
hooks:
- id: terraform-fmt
# Optional argument: path to the Terraform executable
# args: [--terraform=/usr/local/bin/terraform]
This runs the Static analysis tool https://www.checkov.io/ for Terraform, the hook automatically installs the Checkov tool.
For Checkov-scan:
- repo: git://github.com/jameswoolfenden/pre-commit
rev: 0.0.18
hooks:
- id: checkov-scan
files: \.tf$
Updates README.md with Terraform parameters, modules. Requires:
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
The Hook will update in-betweeen with the Terraform-Docs created content. The hook requires that terraform-docs be installed, then add a section to you pre-commit-config.yml, updating to the latest version :
- repo: git://github.com/jameswoolfenden/pre-commit
rev: 0.0.22
hooks:
- id: tf2docs