mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
parent
37dfe9ab4b
commit
bd50003bd7
5 changed files with 29 additions and 28 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
|
repos:
|
||||||
- repo: git://github.com/pre-commit/pre-commit-hooks
|
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||||
sha: v0.6.0
|
sha: v1.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
description: Rewrites all Terraform configuration files to a canonical format.
|
description: Rewrites all Terraform configuration files to a canonical format.
|
||||||
entry: terraform_fmt.sh
|
entry: terraform_fmt.sh
|
||||||
language: script
|
language: script
|
||||||
files: \.tf$
|
files: (\.tf|\.tfvars)$
|
||||||
exclude: \.+.terraform\/.*$
|
exclude: \.terraform\/.*$
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[](https://www.codetriage.com/antonbabenko/pre-commit-terraform)
|
[](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`:
|
An example `.pre-commit-config.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
||||||
sha: v1.2.0
|
sha: v1.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: terraform_fmt
|
- id: terraform_fmt
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
description: Rewrites all Terraform configuration files to a canonical format.
|
description: Rewrites all Terraform configuration files to a canonical format.
|
||||||
entry: terraform_fmt.sh
|
entry: terraform_fmt.sh
|
||||||
language: script
|
language: script
|
||||||
files: \.tf$
|
files: (\.tf|\.tfvars)$
|
||||||
exclude: \.+.terraform\/.*$
|
exclude: \.terraform\/.*$
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
for file in "$@"; do
|
for file in "$@"; do
|
||||||
terraform fmt `dirname $file`
|
terraform fmt "$file"
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue