mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
Added scripts to validate terraform files
This commit is contained in:
parent
70b77dcf32
commit
5f3ac96d44
5 changed files with 48 additions and 2 deletions
|
|
@ -2,14 +2,18 @@
|
|||
|
||||
[](https://github.com/antonbabenko/pre-commit-terraform/releases)  [](https://www.codetriage.com/antonbabenko/pre-commit-terraform)
|
||||
|
||||
Single [pre-commit](http://pre-commit.com/) hook which runs `terraform fmt` on Terraform configuration files (both `*.tf` and `*.tfvars`).
|
||||
Several [pre-commit](http://pre-commit.com/) hooks to keep Terraform configurations (both `*.tf` and `*.tfvars`) in a good shape:
|
||||
* `terraform_fmt` - Rewrites all Terraform configuration files to a canonical format.
|
||||
* `terraform_validate_no_variables` - Validates all Terraform configuration files without checking whether all required variables were set.
|
||||
* `terraform_validate_with_variables` - Validates all Terraform configuration files and checks whether all required variables were specified. This is an optional check, because it will not work if variables are being set dynamically (eg, when using [Terragrunt](https://github.com/gruntwork-io/terragrunt)). Use `terraform_validate_no_variables` hook instead.
|
||||
|
||||
An example `.pre-commit-config.yaml`:
|
||||
|
||||
```yaml
|
||||
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
||||
sha: v1.3.0
|
||||
sha: v1.4.0
|
||||
hooks:
|
||||
- id: terraform_validate_no_variables
|
||||
- id: terraform_fmt
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue