Skip to content

Commit 0d10a11

Browse files
committed
Handle run-all/run --all
1 parent 25f4370 commit 0d10a11

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

hooks/terragrunt_providers_lock.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ function main {
1414
common::parse_and_export_env_vars
1515
# JFYI: terragrunt providers lock color already suppressed via PRE_COMMIT_COLOR=never
1616

17+
readonly RUN_ALL_SUBCOMMAND
18+
if common::terragrunt_version_ge_0.78; then
19+
RUN_ALL_SUBCOMMAND=(run --all providers lock)
20+
else
21+
RUN_ALL_SUBCOMMAND=(run-all providers lock)
22+
fi
23+
1724
# shellcheck disable=SC2153 # False positive
1825
common::per_dir_hook "$HOOK_ID" "${#ARGS[@]}" "${ARGS[@]}" "${FILES[@]}"
1926
}
@@ -63,7 +70,7 @@ function run_hook_on_whole_repo {
6370
local -a -r args=("$@")
6471

6572
# pass the arguments to hook
66-
terragrunt run-all providers lock "${args[@]}"
73+
terragrunt "${RUN_ALL_SUBCOMMAND[@]}" "${args[@]}"
6774

6875
# return exit code to common::per_dir_hook
6976
local exit_code=$?

hooks/terragrunt_validate.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ function main {
1414
common::parse_and_export_env_vars
1515
# JFYI: terragrunt validate color already suppressed via PRE_COMMIT_COLOR=never
1616

17+
readonly RUN_ALL_SUBCOMMAND
18+
if common::terragrunt_version_ge_0.78; then
19+
RUN_ALL_SUBCOMMAND=(run --all validate)
20+
else
21+
RUN_ALL_SUBCOMMAND=(run-all validate)
22+
fi
23+
1724
# shellcheck disable=SC2153 # False positive
1825
common::per_dir_hook "$HOOK_ID" "${#ARGS[@]}" "${ARGS[@]}" "${FILES[@]}"
1926
}
@@ -63,7 +70,7 @@ function run_hook_on_whole_repo {
6370
local -a -r args=("$@")
6471

6572
# pass the arguments to hook
66-
terragrunt run-all validate "${args[@]}"
73+
terragrunt "${RUN_ALL_SUBCOMMAND[@]}" "${args[@]}"
6774

6875
# return exit code to common::per_dir_hook
6976
local exit_code=$?

0 commit comments

Comments
 (0)