# antonbabenko/pre-commit-terraform

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/antonbabenko-pre-commit-terraform).**

3,735 stars · 586 forks · Shell · MIT

## Links

- GitHub: https://github.com/antonbabenko/pre-commit-terraform
- awesome-repositories: https://awesome-repositories.com/repository/antonbabenko-pre-commit-terraform.md

## Description

This project is a set of git pre-commit hooks designed to automate the formatting, linting, and validation of Terraform configurations. It functions as an infrastructure as code linter, security scanner, cost estimator, and documentation generator to ensure code quality before commits are finalized.

The tool distinguishes itself by providing specialized capabilities for infrastructure workflows, such as scanning templates for security vulnerabilities and hardcoded secrets, calculating projected cloud spending against budgets, and automatically extracting module definitions to populate readme files.

The broader capability surface covers infrastructure code formatting for Terraform and YAML files, dependency management for provider lockfiles and version constraints, and syntax validation for both Terraform and Terragrunt inputs.

## Tags

### Development Tools & Productivity

- [Git Pre-Commit Hooks](https://awesome-repositories.com/f/development-tools-productivity/hook-frameworks/framework-specific-hooks/directory-scoped-hook-runs/repository-script-hook-executions/git-pre-commit-hooks.md) — Provides a series of git pre-commit hooks to automate formatting, linting, and validation of Terraform configurations.
- [Configuration File Formats](https://awesome-repositories.com/f/development-tools-productivity/configuration-file-formats.md) — Rewrites infrastructure configuration files into a canonical format to ensure consistent styling. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.pre-commit-hooks.yaml))
- [Configuration File Validators](https://awesome-repositories.com/f/development-tools-productivity/configuration-file-validators.md) — Validates the syntax and settings of Terraform configuration files to prevent invalid commits. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.git_archival.txt))
- [Formatting Configurations](https://awesome-repositories.com/f/development-tools-productivity/formatting-configurations.md) — Automatically standardizes the style and layout of configuration files before committing code. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))
- [Pre-commit Hooks](https://awesome-repositories.com/f/development-tools-productivity/pre-commit-hooks.md) — Implements a series of git hooks to automate formatting and validation before code is committed.
- [Terraform Analyzers](https://awesome-repositories.com/f/development-tools-productivity/static-analysis-tools/terraform-analyzers.md) — Analyzes Terraform configurations for syntax errors, style violations, and logical inconsistencies.
- [Static Code Linting](https://awesome-repositories.com/f/development-tools-productivity/static-code-linting.md) — Scans configuration files for coding errors and style violations using automated linting tools. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/CHANGELOG.md))
- [Syntax Validation](https://awesome-repositories.com/f/development-tools-productivity/syntax-validation.md) — Verifies infrastructure configuration files for syntax errors and logical validity before commits. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.pre-commit-hooks.yaml))
- [Lockfile Reconciliation](https://awesome-repositories.com/f/development-tools-productivity/dependency-lockfiles/lockfile-reconciliation.md) — Synchronizes provider signatures in dependency lock files to ensure cross-platform compatibility. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))
- [Lock File Updates](https://awesome-repositories.com/f/development-tools-productivity/lock-files/lock-file-updates.md) — Refreshes provider signatures in dependency lock files to maintain consistency across environments. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.pre-commit-hooks.yaml))
- [Documentation Generators](https://awesome-repositories.com/f/development-tools-productivity/static-analysis-tools/terraform-analyzers/documentation-generators.md) — Automatically generates and updates module input and output documentation in readme files.

### DevOps & Infrastructure

- [Infrastructure as Code Linters](https://awesome-repositories.com/f/devops-infrastructure/infrastructure-as-code-linters.md) — Provides a comprehensive suite for analyzing Terraform files to detect syntax errors and style violations.
- [Infrastructure Code Formatters](https://awesome-repositories.com/f/devops-infrastructure/infrastructure-code-formatters.md) — Standardizes the layout and style of Terraform configuration files to ensure consistency across the project. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/CHANGELOG.md))
- [Infrastructure Configuration Validations](https://awesome-repositories.com/f/devops-infrastructure/infrastructure-configuration-validations.md) — Checks for misconfigurations and formatting errors in infrastructure deployment settings. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.github/workflows/pre-commit.yaml))
- [General YAML Syntax Validation](https://awesome-repositories.com/f/devops-infrastructure/cicd-pipeline-automation/cicd-pipeline-management/ci-cd-workflows/ci-formatting-checks/general-yaml-syntax-validation.md) — Checks YAML configuration files for structural errors, indentation, and truthy values. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.yamllint))
- [Documentation Automation](https://awesome-repositories.com/f/devops-infrastructure/documentation-automation.md) — Automates the extraction of input and output definitions from modules into readme files. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))
- [Infrastructure Cost Estimators](https://awesome-repositories.com/f/devops-infrastructure/infrastructure-cost-estimators.md) — Calculates projected cloud spending by analyzing configuration code and comparing totals against budget limits. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))
- [Dependency Version Updates](https://awesome-repositories.com/f/devops-infrastructure/version-upgrades/dependency-versioning/dependency-version-updates.md) — Refreshes version requirements for tools, providers, and modules to the latest compatible releases. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))

### Security & Cryptography

- [Secrets Scanning](https://awesome-repositories.com/f/security-cryptography/secrets-scanning.md) — Scans files for hardcoded private keys and cloud credentials to prevent sensitive information leaks. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.pre-commit-config.yaml))
- [Security Vulnerability Scanning](https://awesome-repositories.com/f/security-cryptography/security-vulnerability-scanning.md) — Scans infrastructure templates for security vulnerabilities and compliance violations using static analysis. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))
- [Static Analysis Security Testing](https://awesome-repositories.com/f/security-cryptography/vulnerability-scanning/static-analysis-security-testing.md) — Analyzes infrastructure configuration files without executing them to detect security vulnerabilities and syntax errors.
- [Infrastructure Security Scanners](https://awesome-repositories.com/f/security-cryptography/infrastructure-security-scanners.md) — Evaluates infrastructure templates against security best practices to find vulnerabilities and secrets.

### Software Engineering & Architecture

- [Infrastructure Configurations](https://awesome-repositories.com/f/software-engineering-architecture/code-formatting-standards/infrastructure-configurations.md) — Automatically standardizes the layout and style of Terraform and YAML configuration files.
- [Configuration File Linting](https://awesome-repositories.com/f/software-engineering-architecture/pattern-based-ci-enforcement/ci-linting-enforcement/configuration-file-linting.md) — Analyzes configuration files for stylistic errors and violations of industry best practices. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.pre-commit-config.yaml))

### Content Management & Publishing

- [Automated Document Generation](https://awesome-repositories.com/f/content-management-publishing/automated-document-generation.md) — Automatically updates readme files by inserting input and output documentation based on current module definitions. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/CHANGELOG.md))
- [Infrastructure Configuration Documentation](https://awesome-repositories.com/f/content-management-publishing/automated-document-generation/infrastructure-configuration-documentation.md) — Provides automated generation of module input and output tables within project readme files. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/.pre-commit-hooks.yaml))
- [Module Documentation Generators](https://awesome-repositories.com/f/content-management-publishing/metadata-driven-documentation-generators/module-documentation-generators.md) — Automatically extracts module definitions to populate input and output tables within project readme files.

### System Administration & Monitoring

- [Configuration Variable Detections](https://awesome-repositories.com/f/system-administration-monitoring/global-system-settings/global-variables/static-variable-access/state-variable-access-tracings/unused-written-variable-detections/configuration-variable-detections.md) — Detects unused or undefined inputs in Terragrunt configurations to maintain accurate variable sets. ([source](https://github.com/antonbabenko/pre-commit-terraform#readme))

### Testing & Quality Assurance

- [Infrastructure Variable Validations](https://awesome-repositories.com/f/testing-quality-assurance/validation-verification/input-validation/infrastructure-variable-validations.md) — Identifies unused or undefined input variables in Terragrunt configurations. ([source](https://github.com/antonbabenko/pre-commit-terraform/blob/master/README.md))

### Part of an Awesome List

- [Workflow Automation](https://awesome-repositories.com/f/awesome-lists/devtools/workflow-automation.md) — Git hooks for formatting, validation, and security.
- [Workflow Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/workflow-utilities.md) — Git hooks for formatting, validation, and security.
