Skip to content

Commit a8d163c

Browse files
Apply suggestions from code review
Co-authored-by: George Yermulnik (Georgii Iermulnik) <yz@yz.kiev.ua>
1 parent 25c06b9 commit a8d163c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ To replicate functionality in `terraform_docs` hook:
768768
1. The hook can work in a few different modes:
769769

770770
1. <details><summary><code>--mode=check-lockfile-is-cross-platform</code> (standalone)</summary>
771-
Checks that lockfile has the same amount of platform (`h1:`) checksums as specified in hook configuration. It **does not** check are these checksums are valid or that they are belongs to needed platforms.
771+
Checks that lockfile has the same number of platform checksums (`h1:`) as requested by the hook configuration. It **does not** check whether these checksums are valid or that they match target platforms.
772772

773773
```yaml
774774
- id: terraform_providers_lock
@@ -780,7 +780,7 @@ To replicate functionality in `terraform_docs` hook:
780780

781781
2. <details><summary><code>--mode=regenerate-lockfile-if-some-platform-missed</code> (standalone)</summary>
782782

783-
Checks that lockfile has all required SHAs for all providers already added to lockfile, and if any missed - try to add them (but could fail if `terraform init` wasn't run previously)
783+
Checks that lockfile has checksums (`h1:`) for all requested platforms for all providers tracked by the lockfile, and if any are missed - tries to add them (but could fail if `terraform init` wasn't run previously).
784784

785785

786786
```yaml
@@ -793,10 +793,10 @@ To replicate functionality in `terraform_docs` hook:
793793

794794
3. <details><summary><code>--mode=regenerate-lockfile-if-some-platform-missed</code> with <code>terraform_validate</code> hook</summary>
795795

796-
Make up-to-date lockfile by adding/removing providers and only then check that lockfile has all required SHAs. If any missed - adds them.
796+
Regenerates lockfile for all required providers and checks that the lockfile tracks all required platform checksums (`h1:`) afterwards. If any are missed - adds them; superfluous providers are removed.
797797

798798
> **Important**
799-
> Next [`terraform_validate`](#terraform_validate) hook flag requires additional dependency to be installed: `jq`. Also, it could run another slow and time consuming command - `terraform init`
799+
> The following [`terraform_validate`](#terraform_validate) hook's flag requires additional dependency to be installed: [`jq`](https://github.com/jqlang/jq). Also, it could run another slow and time consuming command - `terraform init`
800800

801801
```yaml
802802
- id: terraform_validate
@@ -810,9 +810,9 @@ To replicate functionality in `terraform_docs` hook:
810810

811811
</details>
812812

813-
4. <details><summary><code>always-regenerate-lockfile</code> - only with terraform_validate hook.</summary>
813+
4. <details><summary><code>always-regenerate-lockfile</code> - meant to be used only along with <code>terraform_validate</code> hook</summary>
814814

815-
Regenerate lockfile from scratch. Can be useful for upgrading providers in lockfile to latest versions
815+
Regenerates lockfile from the scratch. May be useful for upgrading providers in the lockfile to the latest versions.
816816

817817
```yaml
818818
- id: terraform_validate

hooks/terraform_providers_lock.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function per_dir_hook_unique_part {
155155
done
156156

157157
# Available options:
158-
# check-lockfile-is-cross-platform (will be default)
158+
# check-lockfile-is-cross-platform (will be default in v2.0)
159159
# regenerate-lockfile-if-some-platform-missed
160160
# always-regenerate-lockfile
161161
# TODO: Remove in 2.0
@@ -186,8 +186,8 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra
186186
exit 0
187187
fi
188188

189-
common::colorify "yellow" "\n$dir_path/.terraform.lock.hcl missing some of required platforms.
190-
All required platforms: ${platforms_names[*]}."
189+
common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms.
190+
All required platforms: ${platforms_names[*]}.\n"
191191
fi
192192

193193
#? Don't require `tf init` for providers, but required `tf init` for modules

0 commit comments

Comments
 (0)