Skip to content

anmolnagpal/git-hooks-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

pre-commit git hooks to take care of Terraform configurations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages