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
Copy file name to clipboardExpand all lines: README.md
+41-5Lines changed: 41 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -544,12 +544,46 @@ To replicate functionality in `terraform_docs` hook:
544
544
545
545
### terraform_providers_lock
546
546
547
-
1. The hook requires Terraform 0.14 or later.
548
-
1. The hook invokes two operations that can be really slow:
549
-
* `terraform init` (in case `.terraform` directory is not initialized)
550
-
* `terraform providers lock`
547
+
> **Note**: The hook requires Terraform 0.14 or later.
548
+
> **Note**: The hook can invoke `terraform providers lock` that can be really slow and requires fetching metadata from remote Terraform registries - not all of that metadata is currently being cached by Terraform.
549
+
550
+
1. The hook can work in a few different modes: `only-check-is-current-lockfile-cross-platform`with and without [terraform_validate hook](#terraform_validate) and `always-regenerate-lockfile` - only with terraform_validate hook.
551
+
552
+
* `only-check-is-current-lockfile-cross-platform` without terraform_validate - only checks that lockfile have all required SHAs for all already added to lockfile providers.
* `only-check-is-current-lockfile-cross-platform` with [terraform_validate hook](#terraform_validate) - make up-to-date lockfile by adding/removing providers and only then check that lockfile has all required SHAs.
561
+
562
+
> **Note**: Next `terraform_validate` flag requires additional dependency to be installed: `jq`. Also, it could run another slow and time consuming command - `terraform init`
* `always-regenerate-lockfile` only with [terraform_validate hook](#terraform_validate) - regenerate lockfile from scratch. Can be useful for upgrading providers in lockfile to latest versions
575
+
576
+
```yaml
577
+
- id: terraform_validate
578
+
args:
579
+
- --hook-config=--retry-once-with-cleanup=true
580
+
- --tf-init-args=-upgrade
581
+
582
+
- id: terraform_providers_lock
583
+
args:
584
+
- --hook-config=--mode=always-regenerate-lockfile
585
+
```
551
586
552
-
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.
@@ -576,6 +610,8 @@ To replicate functionality in `terraform_docs` hook:
576
610
577
611
1. `terraform_providers_lock` support passing custom arguments to its `terraform init`:
578
612
613
+
> **Warning** - DEPRECATION NOTICE: This available only in `no-mode` mode, which will be removed in v2.0. Please provide this keys to [`terraform_validate`](#terraform_validate) hook, which, to take effect, should be called before `terraform_providers_lock`
0 commit comments