Analysis updated 2026-07-03
Block Terraform commits that have formatting or syntax errors without manually running checks
Automatically regenerate Terraform module documentation every time code changes
Scan infrastructure-as-code for security vulnerabilities before code is merged
Estimate cloud cost changes caused by a pull request using infracost before it ships
| antonbabenko/pre-commit-terraform | arialdomartini/oh-my-git | olegos2/mobox | |
|---|---|---|---|
| Stars | 3,711 | 3,709 | 3,700 |
| Language | Shell | Shell | Shell |
| Setup difficulty | moderate | moderate | hard |
| Complexity | 3/5 | 2/5 | 4/5 |
| Audience | ops devops | developer | general |
Figures from each repo's GitHub metadata at analysis time.
Requires pre-commit framework installed plus individual tools (tflint, terraform-docs, etc.) or the bundled Docker image.
Pre-commit-terraform is a collection of Git hooks designed to automatically check and format Terraform configuration files before you commit code. Terraform is a tool used to define and manage cloud infrastructure by writing configuration files. A Git hook is a script that runs automatically at a certain point in the version control process, for example right before you save a new commit. The pre-commit framework is a system that manages and runs these hooks across multiple languages and tools. When you set this up in a project, it runs a series of checks every time a developer commits. The checks cover formatting so that all Terraform files follow a consistent style, validation to catch syntax errors and configuration mistakes, security scanning to flag potential vulnerabilities in the infrastructure definitions, and documentation generation to keep module documentation up to date automatically. If any check fails, the commit is blocked until the issue is fixed. The hooks support Terraform, OpenTofu (an open-source fork of Terraform), and Terragrunt. You can run them locally on your own machine before pushing code, or in a continuous integration pipeline so every pull request is checked automatically. A Docker image is provided that bundles all the supported tools together, which avoids the need to install each tool individually on every developer's machine. Specific hooks include terraform-fmt for formatting, terraform-validate for syntax checking, terraform-docs for updating documentation from code, tflint for deeper linting rules, trivy and checkov for security scanning, infracost for estimating cloud spending changes, and tfupdate for keeping provider version references current. Many hooks can run in parallel to keep the overall check time short. Installation involves adding a configuration file to your repository that lists which hooks you want, then running one setup command. The full README is longer than what was shown.
A set of automatic checks that run before every Git commit on Terraform files, catching formatting issues, syntax errors, security problems, and outdated docs before code is saved.
Mainly Shell. The stack also includes Shell, Terraform, Docker.
Not specified in the explanation.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly ops devops.
This repo across BitVibe Labs
Verify against the repo before relying on details.