You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -183,8 +184,8 @@ There are several [pre-commit](https://pre-commit.com/) hooks to keep Terraform
183
184
|`terraform_docs_replace`| Runs `terraform-docs` and pipes the output directly to README.md |
184
185
|`terraform_docs_without_aggregate_type_defaults`| Inserts input and output documentation into `README.md` without aggregate type defaults. Hook notes same as for [terraform_docs](#terraform_docs) |
185
186
|`terraform_docs`| Inserts input and output documentation into `README.md`. Recommended. [Hook notes](#terraform_docs) |
186
-
|`terraform_fmt`| Rewrites all Terraform configuration files to a canonical format. [Hook notes](#terraform_docs) |
187
-
|`terraform_providers_lock`| Updates provider signatures in [dependency lock files](https://www.terraform.io/docs/cli/commands/providers/lock.html). [Hook notes](#terraform_providers_lock)
187
+
|`terraform_fmt`| Rewrites all Terraform configuration files to a canonical format. [Hook notes](#terraform_fmt) |
|`terraform_tflint`| Validates all Terraform configuration files with [TFLint](https://github.com/terraform-linters/tflint). [Available TFLint rules](https://github.com/terraform-linters/tflint/tree/master/docs/rules#rules). [Hook notes](#terraform_tflint). |
189
190
|`terraform_tfsec`| [TFSec](https://github.com/liamg/tfsec) static analysis of terraform templates to spot potential security issues. [Hook notes](#terraform_tfsec) |
190
191
|`terraform_validate`| Validates all Terraform configuration files. [Hook notes](#terraform_validate) |
@@ -243,6 +244,50 @@ Example:
243
244
- --dest=TEST.md
244
245
```
245
246
247
+
### terraform_fmt
248
+
249
+
1. `terraform_fmt` supports custom arguments so you can pass [supported flags](https://www.terraform.io/docs/cli/commands/fmt.html#usage). Eg:
250
+
251
+
```yaml
252
+
- id: terraform_fmt
253
+
args:
254
+
- --args=-no-color
255
+
- --args=-diff
256
+
- --args=-write=false
257
+
```
258
+
259
+
### terraform_providers_lock
260
+
261
+
1. The hook requires Terraform 0.14 or later.
262
+
2. The hook invokes two operations that can be really slow:
263
+
*`terraform init` (in case`.terraform` directory is not initialised)
264
+
*`terraform providers lock`.
265
+
266
+
Both operations require downloading data from remote Terraform registries, and not all of that downloaded data or meta-data is currently being cached by Terraform.
4. It may happen that Terraform working directory (`.terraform`) already exists but not in the best condition (eg, not initialized modules, wrong version of Terraform, etc). To solve this problem you can find and delete all `.terraform` directories in your repository:
# Reload shell and use `rm_terraform` command in repo root
287
+
```
288
+
289
+
`terraform_providers_lock` hook will try to reinitialize them before running `terraform providers lock` command.
290
+
246
291
### terraform_tflint
247
292
248
293
1. `terraform_tflint` supports custom arguments so you can enable module inspection, deep check mode etc.
@@ -344,44 +389,6 @@ Example:
344
389
345
390
**Warning:** If you use Terraform workspaces, DO NOT use this workaround ([details](https://github.com/antonbabenko/pre-commit-terraform/issues/203#issuecomment-918791847)). Wait to [`force-init`](https://github.com/antonbabenko/pre-commit-terraform/issues/224) option implementation
346
391
347
-
### terraform_providers_lock
348
-
349
-
1. The hook requires Terraform 0.14 or later.
350
-
351
-
1. The hook invokes two operations that can be really slow:
352
-
`terraform init` (in case`.terraform` directory is not initialised)
353
-
and `terraform providers lock`. Both operations require downloading
354
-
data from remote Terraform registries, and not all of that
355
-
downloaded data or meta-data is currently being cached by Terraform.
0 commit comments