forked from github/pre-commit-opentofu
parent
37dfe9ab4b
commit
bd50003bd7
5 changed files with 29 additions and 28 deletions
|
|
@ -1,8 +1,9 @@
|
|||
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||
sha: v0.6.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: check-case-conflict
|
||||
- id: check-merge-conflict
|
||||
repos:
|
||||
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||
sha: v1.2.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: check-case-conflict
|
||||
- id: check-merge-conflict
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
- id: terraform_fmt
|
||||
name: Terraform fmt
|
||||
description: Rewrites all Terraform configuration files to a canonical format.
|
||||
entry: terraform_fmt.sh
|
||||
language: script
|
||||
files: \.tf$
|
||||
exclude: \.+.terraform\/.*$
|
||||
- id: terraform_fmt
|
||||
name: Terraform fmt
|
||||
description: Rewrites all Terraform configuration files to a canonical format.
|
||||
entry: terraform_fmt.sh
|
||||
language: script
|
||||
files: (\.tf|\.tfvars)$
|
||||
exclude: \.terraform\/.*$
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
[](https://www.codetriage.com/antonbabenko/pre-commit-terraform)
|
||||
|
||||
Single [pre-commit](http://pre-commit.com/) hook which runs `terraform fmt` on `*.tf` files.
|
||||
Single [pre-commit](http://pre-commit.com/) hook which runs `terraform fmt` on Terraform configuration files (both `*.tf` and `*.tfvars`).
|
||||
|
||||
An example `.pre-commit-config.yaml`:
|
||||
|
||||
```yaml
|
||||
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
||||
sha: v1.2.0
|
||||
hooks:
|
||||
- id: terraform_fmt
|
||||
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
||||
sha: v1.3.0
|
||||
hooks:
|
||||
- id: terraform_fmt
|
||||
```
|
||||
|
||||
Enjoy the clean code!
|
||||
|
|
|
|||
14
hooks.yaml
14
hooks.yaml
|
|
@ -1,7 +1,7 @@
|
|||
- id: terraform_fmt
|
||||
name: Terraform fmt
|
||||
description: Rewrites all Terraform configuration files to a canonical format.
|
||||
entry: terraform_fmt.sh
|
||||
language: script
|
||||
files: \.tf$
|
||||
exclude: \.+.terraform\/.*$
|
||||
- id: terraform_fmt
|
||||
name: Terraform fmt
|
||||
description: Rewrites all Terraform configuration files to a canonical format.
|
||||
entry: terraform_fmt.sh
|
||||
language: script
|
||||
files: (\.tf|\.tfvars)$
|
||||
exclude: \.terraform\/.*$
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
for file in "$@"; do
|
||||
terraform fmt `dirname $file`
|
||||
terraform fmt "$file"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue