From 0dd21f03d9175eadeeb527979354689a1c0c7cdc Mon Sep 17 00:00:00 2001 From: MaxymVlasov Date: Fri, 28 Nov 2025 18:55:11 +0200 Subject: [PATCH 01/12] fix(`terraform_providers_lock`): Log in which folder hook failed --- hooks/terraform_providers_lock.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 9a4d1b624..138c9a8cf 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -157,8 +157,14 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra # pass the arguments to hook "$tf_path" providers lock "${args[@]}" - # return exit code to common::per_dir_hook exit_code=$? + if [[ $exit_code != 0 ]]; then + common::colorify "red" "$dir_path run failed. Detailed error above. +Most common issue is that you didn't run requiring 'terraform init' before running this hook. It can be run by 'terraform_validate' hook - https://github.com/antonbabenko/pre-commit-terraform#terraform_validate +" + fi + + # return exit code to common::per_dir_hook return $exit_code } From f74b9d750396da7ac2b40b99d72d80759576e1ba Mon Sep 17 00:00:00 2001 From: Maksym Vlasov Date: Fri, 28 Nov 2025 22:26:26 +0200 Subject: [PATCH 02/12] Apply suggestions from code review Co-authored-by: George Yermulnik (Georgii Iermulnik) --- hooks/terraform_providers_lock.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 138c9a8cf..867e76053 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -158,9 +158,9 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra "$tf_path" providers lock "${args[@]}" exit_code=$? - if [[ $exit_code != 0 ]]; then + if [[ $exit_code -ne 0 ]]; then common::colorify "red" "$dir_path run failed. Detailed error above. -Most common issue is that you didn't run requiring 'terraform init' before running this hook. It can be run by 'terraform_validate' hook - https://github.com/antonbabenko/pre-commit-terraform#terraform_validate +Most common issue is that required 'terraform init' command was likely not run before running this hook. It might be run for you automatically by 'terraform_validate' hook - see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate for more details " fi From bb0f63e932241958562469c13cc435c76effc2fa Mon Sep 17 00:00:00 2001 From: MaxymVlasov Date: Mon, 29 Dec 2025 14:36:52 +0200 Subject: [PATCH 03/12] Add verbose output about missed platforms --- hooks/terraform_providers_lock.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 867e76053..e1b01d843 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -101,9 +101,11 @@ function per_dir_hook_unique_part { local -a -r args=("$@") local platforms_count=0 + local platforms_names=() for arg in "${args[@]}"; do if grep -Eq '^-platform=' <<< "$arg"; then platforms_count=$((platforms_count + 1)) + platforms_names+=("${arg#*=}") fi done @@ -146,10 +148,13 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra } fi - if [ "$mode" == "only-check-is-current-lockfile-cross-platform" ] && - lockfile_contains_all_needed_sha "$platforms_count"; then + if [ "$mode" == "only-check-is-current-lockfile-cross-platform" ]; then - exit 0 + if lockfile_contains_all_needed_sha "$platforms_count"; then + exit 0 + fi + + common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms (${platforms_names[*]})." fi #? Don't require `tf init` for providers, but required `tf init` for modules From bf77b74b0e6c7c6ec01ce8f8d8e9a41d5b9b8833 Mon Sep 17 00:00:00 2001 From: MaxymVlasov Date: Mon, 29 Dec 2025 14:40:59 +0200 Subject: [PATCH 04/12] Make logs more pretty --- hooks/terraform_providers_lock.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index e1b01d843..1fb31a821 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -154,7 +154,8 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra exit 0 fi - common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms (${platforms_names[*]})." + common::colorify "yellow" "\n$dir_path/.terraform.lock.hcl missing some of required platforms. + All required platforms: ${platforms_names[*]}." fi #? Don't require `tf init` for providers, but required `tf init` for modules From feea5f1fee9b8928beba5a5391224e714914714b Mon Sep 17 00:00:00 2001 From: MaxymVlasov Date: Mon, 5 Jan 2026 19:18:14 +0200 Subject: [PATCH 05/12] Add `check-lockfile-is-cross-platform` mode, rename mode `only-check-is-current-lockfile-cross-platform` to `regenerate-lockfile-if-some-platform-missed` --- README.md | 40 ++++++++++++++++++++++++------- hooks/terraform_providers_lock.sh | 21 ++++++++++++++-- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2ca672780..42635cc1e 100644 --- a/README.md +++ b/README.md @@ -759,26 +759,44 @@ To replicate functionality in `terraform_docs` hook: > - --hook-config=--mode=always-regenerate-lockfile > ``` > -> Why? When v2.x will be introduced - the default mode will be changed, probably, to `only-check-is-current-lockfile-cross-platform`. +> Why? When v2.x will be introduced - the default mode will be changed, probably, to `check-lockfile-is-cross-platform`. > > You can check available modes for hook below. > -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. +1. The hook can work in a few different modes: - * `only-check-is-current-lockfile-cross-platform` without terraform_validate - only checks that lockfile has all required SHAs for all providers already added to lockfile. + 1.
--mode=check-lockfile-is-cross-platform (standalone) + 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. ```yaml - id: terraform_providers_lock args: - - --hook-config=--mode=only-check-is-current-lockfile-cross-platform + - --hook-config=--mode=check-lockfile-is-cross-platform ``` - * `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. +
+ + 2.
--mode=regenerate-lockfile-if-some-platform-missed (standalone) + + 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) + + + ```yaml + - id: terraform_providers_lock + args: + - --hook-config=--mode=regenerate-lockfile-if-some-platform-missed + ``` + +
+ + 3.
--mode=regenerate-lockfile-if-some-platform-missed with terraform_validate hook + + Make up-to-date lockfile by adding/removing providers and only then check that lockfile has all required SHAs. If any missed - adds them. > **Important** - > Next `terraform_validate` flag requires additional dependency to be installed: `jq`. Also, it could run another slow and time consuming command - `terraform init` + > 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` ```yaml - id: terraform_validate @@ -787,10 +805,14 @@ To replicate functionality in `terraform_docs` hook: - id: terraform_providers_lock args: - - --hook-config=--mode=only-check-is-current-lockfile-cross-platform + - --hook-config=--mode=regenerate-lockfile-if-some-platform-missed ``` - * `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 +
+ + 4.
always-regenerate-lockfile - only with terraform_validate hook. + + Regenerate lockfile from scratch. Can be useful for upgrading providers in lockfile to latest versions ```yaml - id: terraform_validate @@ -803,6 +825,8 @@ To replicate functionality in `terraform_docs` hook: - --hook-config=--mode=always-regenerate-lockfile ``` +
+ 2. `terraform_providers_lock` supports custom arguments: ```yaml diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 1fb31a821..2f25d205b 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -135,7 +135,8 @@ function per_dir_hook_unique_part { done # Available options: - # only-check-is-current-lockfile-cross-platform (will be default) + # check-lockfile-is-cross-platform (will be default) + # regenerate-lockfile-if-some-platform-missed # always-regenerate-lockfile # TODO: Remove in 2.0 if [ ! "$mode" ]; then @@ -146,9 +147,25 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra exit_code=$? return $exit_code } + elif [ "$mode" == "only-check-is-current-lockfile-cross-platform" ]; then + common::colorify "yellow" "DEPRECATION NOTICE: Flag '--mode=only-check-is-current-lockfile-cross-platform' was renamed + to '--mode=regenerate-lockfile-if-some-platform-missed' to better reflect its behavior. Please update your configuration. +" + mode="regenerate-lockfile-if-some-platform-missed" + fi + + if [ "$mode" == "check-lockfile-is-cross-platform" ]; then + + if lockfile_contains_all_needed_sha "$platforms_count"; then + exit 0 + fi + + common::colorify "red" "\n$dir_path/.terraform.lock.hcl missing some of required platforms. + All required platforms: ${platforms_names[*]}." + exit 1 fi - if [ "$mode" == "only-check-is-current-lockfile-cross-platform" ]; then + if [ "$mode" == "regenerate-lockfile-if-some-platform-missed" ]; then if lockfile_contains_all_needed_sha "$platforms_count"; then exit 0 From bc820c6ddac12f731a433696575671d310d98fc1 Mon Sep 17 00:00:00 2001 From: MaxymVlasov Date: Mon, 5 Jan 2026 19:35:57 +0200 Subject: [PATCH 06/12] Add validation for modes --- hooks/terraform_providers_lock.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 2f25d205b..9494e8732 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -130,6 +130,26 @@ function per_dir_hook_unique_part { exit 1 fi mode=$value + + case $mode in + check-lockfile-is-cross-platform) ;; + regenerate-lockfile-if-some-platform-missed) ;; + always-regenerate-lockfile) ;; + + only-check-is-current-lockfile-cross-platform) + common::colorify "yellow" "DEPRECATION NOTICE: Flag '--mode=only-check-is-current-lockfile-cross-platform' was renamed + to '--mode=regenerate-lockfile-if-some-platform-missed' to better reflect its behavior. Please update your configuration. +" + mode="regenerate-lockfile-if-some-platform-missed" + ;; + *) + common::colorify "red" "Invalid hook config. Supported --mode values are: + - check-lockfile-is-cross-platform + - regenerate-lockfile-if-some-platform-missed + - always-regenerate-lockfile" + exit 1 + ;; + esac ;; esac done @@ -147,11 +167,6 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra exit_code=$? return $exit_code } - elif [ "$mode" == "only-check-is-current-lockfile-cross-platform" ]; then - common::colorify "yellow" "DEPRECATION NOTICE: Flag '--mode=only-check-is-current-lockfile-cross-platform' was renamed - to '--mode=regenerate-lockfile-if-some-platform-missed' to better reflect its behavior. Please update your configuration. -" - mode="regenerate-lockfile-if-some-platform-missed" fi if [ "$mode" == "check-lockfile-is-cross-platform" ]; then From a8d163c12fbda14e905b71ceab01c303e3deaf08 Mon Sep 17 00:00:00 2001 From: Maksym Vlasov Date: Mon, 5 Jan 2026 22:44:48 +0200 Subject: [PATCH 07/12] Apply suggestions from code review Co-authored-by: George Yermulnik (Georgii Iermulnik) --- README.md | 12 ++++++------ hooks/terraform_providers_lock.sh | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8708ea8c2..59f01426e 100644 --- a/README.md +++ b/README.md @@ -768,7 +768,7 @@ To replicate functionality in `terraform_docs` hook: 1. The hook can work in a few different modes: 1.
--mode=check-lockfile-is-cross-platform (standalone) - 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. + 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. ```yaml - id: terraform_providers_lock @@ -780,7 +780,7 @@ To replicate functionality in `terraform_docs` hook: 2.
--mode=regenerate-lockfile-if-some-platform-missed (standalone) - 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) + 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). ```yaml @@ -793,10 +793,10 @@ To replicate functionality in `terraform_docs` hook: 3.
--mode=regenerate-lockfile-if-some-platform-missed with terraform_validate hook - Make up-to-date lockfile by adding/removing providers and only then check that lockfile has all required SHAs. If any missed - adds them. + 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. > **Important** - > 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` + > 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` ```yaml - id: terraform_validate @@ -810,9 +810,9 @@ To replicate functionality in `terraform_docs` hook:
- 4.
always-regenerate-lockfile - only with terraform_validate hook. + 4.
always-regenerate-lockfile - meant to be used only along with terraform_validate hook - Regenerate lockfile from scratch. Can be useful for upgrading providers in lockfile to latest versions + Regenerates lockfile from the scratch. May be useful for upgrading providers in the lockfile to the latest versions. ```yaml - id: terraform_validate diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 9494e8732..f096f4c57 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -155,7 +155,7 @@ function per_dir_hook_unique_part { done # Available options: - # check-lockfile-is-cross-platform (will be default) + # check-lockfile-is-cross-platform (will be default in v2.0) # regenerate-lockfile-if-some-platform-missed # always-regenerate-lockfile # TODO: Remove in 2.0 @@ -186,8 +186,8 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra exit 0 fi - common::colorify "yellow" "\n$dir_path/.terraform.lock.hcl missing some of required platforms. - All required platforms: ${platforms_names[*]}." + common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms. + All required platforms: ${platforms_names[*]}.\n" fi #? Don't require `tf init` for providers, but required `tf init` for modules From e38d0fd9b4140b9fcdf1c25598ff78601fee9312 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 5 Jan 2026 23:04:03 +0200 Subject: [PATCH 08/12] Switch from `if` to `case` --- hooks/terraform_providers_lock.sh | 33 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index f096f4c57..66c9899be 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -169,26 +169,27 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra } fi - if [ "$mode" == "check-lockfile-is-cross-platform" ]; then - - if lockfile_contains_all_needed_sha "$platforms_count"; then - exit 0 - fi + case "$mode" in + "check-lockfile-is-cross-platform") + if lockfile_contains_all_needed_sha "$platforms_count"; then + exit 0 + fi - common::colorify "red" "\n$dir_path/.terraform.lock.hcl missing some of required platforms. - All required platforms: ${platforms_names[*]}." - exit 1 - fi + common::colorify "red" "$dir_path/.terraform.lock.hcl missing some of required platforms. + All required platforms: ${platforms_names[*]}" - if [ "$mode" == "regenerate-lockfile-if-some-platform-missed" ]; then + exit 1 + ;; + "regenerate-lockfile-if-some-platform-missed") + if lockfile_contains_all_needed_sha "$platforms_count"; then + exit 0 + fi - if lockfile_contains_all_needed_sha "$platforms_count"; then - exit 0 - fi + common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms. + All required platforms: ${platforms_names[*]}\n" - common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms. - All required platforms: ${platforms_names[*]}.\n" - fi + ;; + esac #? Don't require `tf init` for providers, but required `tf init` for modules #? Mitigated by `function match_validate_errors` from terraform_validate hook From 8cd684f7658a65fd5d216d7f5b5ebce973f3d269 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 5 Jan 2026 23:07:08 +0200 Subject: [PATCH 09/12] Fix indentation in output messages --- hooks/terraform_providers_lock.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 66c9899be..15548d01b 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -176,7 +176,8 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra fi common::colorify "red" "$dir_path/.terraform.lock.hcl missing some of required platforms. - All required platforms: ${platforms_names[*]}" +All required platforms: ${platforms_names[*]} +" exit 1 ;; @@ -186,7 +187,8 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra fi common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms. - All required platforms: ${platforms_names[*]}\n" +All required platforms: ${platforms_names[*]} +" ;; esac From 1ccfcb2f40c90bdc1e22d1f2e386b465d713de15 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 5 Jan 2026 23:09:31 +0200 Subject: [PATCH 10/12] Wrap var in double quotes --- hooks/terraform_providers_lock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 15548d01b..51c4bddd7 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -123,7 +123,7 @@ function per_dir_hook_unique_part { key=${config[0]} value=${config[1]} - case $key in + case "$key" in --mode) if [ "$mode" ]; then common::colorify "yellow" 'Invalid hook config. Make sure that you specify not more than one "--mode" flag' From 2bba75cb2fa6c981d596f17e5a31ce2080bf760a Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 5 Jan 2026 23:55:05 +0200 Subject: [PATCH 11/12] Address Coderabbit suggestion and make messages more consistent --- hooks/terraform_providers_lock.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 51c4bddd7..056611976 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -126,19 +126,19 @@ function per_dir_hook_unique_part { case "$key" in --mode) if [ "$mode" ]; then - common::colorify "yellow" 'Invalid hook config. Make sure that you specify not more than one "--mode" flag' + common::colorify "yellow" 'Invalid hook config. Make sure that you specify not more than one "--mode" flag.' exit 1 fi mode=$value - case $mode in + case "$mode" in check-lockfile-is-cross-platform) ;; regenerate-lockfile-if-some-platform-missed) ;; always-regenerate-lockfile) ;; only-check-is-current-lockfile-cross-platform) - common::colorify "yellow" "DEPRECATION NOTICE: Flag '--mode=only-check-is-current-lockfile-cross-platform' was renamed - to '--mode=regenerate-lockfile-if-some-platform-missed' to better reflect its behavior. Please update your configuration. + common::colorify "yellow" "DEPRECATION NOTICE: Flag '--mode=only-check-is-current-lockfile-cross-platform' was renamed to '--mode=regenerate-lockfile-if-some-platform-missed' to better reflect its behavior. +Please update your configuration. " mode="regenerate-lockfile-if-some-platform-missed" ;; @@ -201,7 +201,7 @@ All required platforms: ${platforms_names[*]} exit_code=$? if [[ $exit_code -ne 0 ]]; then common::colorify "red" "$dir_path run failed. Detailed error above. -Most common issue is that required 'terraform init' command was likely not run before running this hook. It might be run for you automatically by 'terraform_validate' hook - see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate for more details +Most common issue is that required 'terraform init' command was likely not run before running this hook. It might be run for you automatically by 'terraform_validate' hook - see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate for more details. " fi From bf7fdce4054c6cffb6ac831a5045bb9eca0d5c43 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Tue, 6 Jan 2026 12:38:13 +0200 Subject: [PATCH 12/12] Remove extraneous newlines in output messages --- hooks/terraform_providers_lock.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/hooks/terraform_providers_lock.sh b/hooks/terraform_providers_lock.sh index 056611976..32283cd33 100755 --- a/hooks/terraform_providers_lock.sh +++ b/hooks/terraform_providers_lock.sh @@ -138,8 +138,7 @@ function per_dir_hook_unique_part { only-check-is-current-lockfile-cross-platform) common::colorify "yellow" "DEPRECATION NOTICE: Flag '--mode=only-check-is-current-lockfile-cross-platform' was renamed to '--mode=regenerate-lockfile-if-some-platform-missed' to better reflect its behavior. -Please update your configuration. -" +Please update your configuration." mode="regenerate-lockfile-if-some-platform-missed" ;; *) @@ -161,8 +160,7 @@ Please update your configuration. # TODO: Remove in 2.0 if [ ! "$mode" ]; then common::colorify "yellow" "DEPRECATION NOTICE: We introduced '--mode' flag for this hook. -Check migration instructions at https://github.com/antonbabenko/pre-commit-terraform#terraform_providers_lock -" +Check migration instructions at https://github.com/antonbabenko/pre-commit-terraform#terraform_providers_lock" common::terraform_init "$tf_path providers lock" "$dir_path" "$parallelism_disabled" "$tf_path" || { exit_code=$? return $exit_code @@ -176,8 +174,7 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra fi common::colorify "red" "$dir_path/.terraform.lock.hcl missing some of required platforms. -All required platforms: ${platforms_names[*]} -" +All required platforms: ${platforms_names[*]}" exit 1 ;; @@ -187,8 +184,7 @@ All required platforms: ${platforms_names[*]} fi common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms. -All required platforms: ${platforms_names[*]} -" +All required platforms: ${platforms_names[*]}" ;; esac @@ -201,8 +197,7 @@ All required platforms: ${platforms_names[*]} exit_code=$? if [[ $exit_code -ne 0 ]]; then common::colorify "red" "$dir_path run failed. Detailed error above. -Most common issue is that required 'terraform init' command was likely not run before running this hook. It might be run for you automatically by 'terraform_validate' hook - see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate for more details. -" +Most common issue is that required 'terraform init' command was likely not run before running this hook. It might be run for you automatically by 'terraform_validate' hook - see https://github.com/antonbabenko/pre-commit-terraform#terraform_validate for more details." fi # return exit code to common::per_dir_hook