Skip to content

Latest commit

 

History

History
58 lines (49 loc) · 1.53 KB

README.md

File metadata and controls

58 lines (49 loc) · 1.53 KB

Git Hooks for terraform

pre-commit hooks to keep Terraform configurations in a good shape ;)


Hooks available

  • fmt - Rewrites all Terraform configuration files to a canonical format.
  • validate - Validates all Terraform configuration files.

Enjoy the clean and documented code!

🔰Getting Started

Follow the steps below to get started

🔨 Setting Up pre-commit

install the pre-commit package

  • Using pip:
pip install pre-commit
  • Using homebrew:
brew install pre-commit

Step into the repository you want to have the pre-commit hooks installed and run:

cat <<EOF > .pre-commit-config.yaml
- repo: git://github.com/anmolnagpal/git-hooks-terraform
  rev: v1.0.0 # Use the ref you want to point at
  hooks:
  - id: fmt
  - id: validate      
- repo: git://github.com/pre-commit/pre-commit-hooks
  rev: v2.1.0 # Use the ref you want to point at
  hooks:
    - id: check-merge-conflict
EOF

Install the pre-commit hook

pre-commit install

After pre-commit hook has been installed you can run it manually on all files in the repository

pre-commit run -a

📚Refrence

👬 Contribution

  • Open pull request with improvements
  • Discuss ideas in issues
  • Reach out with any feedback Twitter URL