Skip to content

Commit bb0f63e

Browse files
committed
Add verbose output about missed platforms
1 parent f74b9d7 commit bb0f63e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

hooks/terraform_providers_lock.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ function per_dir_hook_unique_part {
101101
local -a -r args=("$@")
102102

103103
local platforms_count=0
104+
local platforms_names=()
104105
for arg in "${args[@]}"; do
105106
if grep -Eq '^-platform=' <<< "$arg"; then
106107
platforms_count=$((platforms_count + 1))
108+
platforms_names+=("${arg#*=}")
107109
fi
108110
done
109111

@@ -146,10 +148,13 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra
146148
}
147149
fi
148150

149-
if [ "$mode" == "only-check-is-current-lockfile-cross-platform" ] &&
150-
lockfile_contains_all_needed_sha "$platforms_count"; then
151+
if [ "$mode" == "only-check-is-current-lockfile-cross-platform" ]; then
151152

152-
exit 0
153+
if lockfile_contains_all_needed_sha "$platforms_count"; then
154+
exit 0
155+
fi
156+
157+
common::colorify "yellow" "$dir_path/.terraform.lock.hcl missing some of required platforms (${platforms_names[*]})."
153158
fi
154159

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

0 commit comments

Comments
 (0)