Initial commit

This commit is contained in:
Anton Babenko 2016-09-27 19:47:26 +02:00
commit 8c2226857e
4 changed files with 31 additions and 2 deletions

8
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,8 @@
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v0.4.2
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- id: check-merge-conflict

View file

@ -1,2 +1,14 @@
# pre-commit-terraform
pre-commit git hook for Terraform
# pre-commit-terraform hooks
Single [pre-commit](http://pre-commit.com/) hook which runs `terraform fmt` on `*.tf` files.
An example `.pre-commit-config.yaml`:
```yaml
- repo: git@github.com:antonbabenko/pre-commit-terraform
sha: HEAD
hooks:
- id: terraform_fmt
```
Enjoy the clean code!

6
hooks.yaml Normal file
View file

@ -0,0 +1,6 @@
- id: terraform_fmt
name: Terraform fmt
description: Rewrites all Terraform configuration files to a canonical format.
entry: tffmthook.sh
language: script
files: \.tf$

3
tffmthook.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
[[ -z $(terraform fmt "$@") ]]