Skip to content

Commit 718ff95

Browse files
fix(terragrunt_providers_lock, terragrunt_validate: Properly handle arguments passed from terragrunt to TF (#939)
1 parent 6e63792 commit 718ff95

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

hooks/terragrunt_providers_lock.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ function main {
1515
# JFYI: terragrunt providers lock color already suppressed via PRE_COMMIT_COLOR=never
1616

1717
if common::terragrunt_version_ge_0.78; then
18+
local -ra SUBCOMMAND=(run -- providers lock)
1819
local -ra RUN_ALL_SUBCOMMAND=(run --all -- providers lock)
1920
else
21+
local -ra SUBCOMMAND=(providers lock)
2022
local -ra RUN_ALL_SUBCOMMAND=(run-all providers lock)
2123
fi
2224

@@ -52,7 +54,7 @@ function per_dir_hook_unique_part {
5254
local -a -r args=("$@")
5355

5456
# pass the arguments to hook
55-
terragrunt providers lock "${args[@]}"
57+
terragrunt "${SUBCOMMAND[@]}" "${args[@]}"
5658

5759
# return exit code to common::per_dir_hook
5860
local exit_code=$?

hooks/terragrunt_validate.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ function main {
1515
# JFYI: terragrunt validate color already suppressed via PRE_COMMIT_COLOR=never
1616

1717
if common::terragrunt_version_ge_0.78; then
18+
local -ra SUBCOMMAND=(run -- validate)
1819
local -ra RUN_ALL_SUBCOMMAND=(run --all -- validate)
1920
else
21+
local -ra SUBCOMMAND=(validate)
2022
local -ra RUN_ALL_SUBCOMMAND=(run-all validate)
2123
fi
2224

@@ -52,7 +54,7 @@ function per_dir_hook_unique_part {
5254
local -a -r args=("$@")
5355

5456
# pass the arguments to hook
55-
terragrunt validate "${args[@]}"
57+
terragrunt "${SUBCOMMAND[@]}" "${args[@]}"
5658

5759
# return exit code to common::per_dir_hook
5860
local exit_code=$?

0 commit comments

Comments
 (0)