Skip to content

Commit 5362ca0

Browse files
committed
deal with RO var
1 parent 6fad8c8 commit 5362ca0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

hooks/_common.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,16 +558,17 @@ function common::terraform_init {
558558
# The global provider cache is safe for concurrent use by multiple processes for OpenTofu v1.10+
559559
# More details - https://github.com/opentofu/opentofu/pull/1878
560560
# For that reason, we switch to `tofu init` when possible
561+
local tf_init_path=$tf_path
561562
if [[ "$($tf_path -version | head -1 | grep -o '^Terraform')" == "Terraform" ]] &&
562563
common::tofu_version_ge_1.10; then
563-
tf_path=$(command -v tofu)
564-
common::colorify "green" "Using OpenTofu binary ($tf_path) for Terraform init operations, as it supports concurrent provider initialization."
564+
tf_init_path=$(command -v tofu)
565+
common::colorify "green" "Using OpenTofu binary ($tf_init_path) for Terraform init operations, as it supports concurrent provider initialization."
565566
fi
566567

567568
# Locking just doesn't work, and the below works quicker instead. Details:
568569
# https://github.com/hashicorp/terraform/issues/31964#issuecomment-1939869453
569570
for i in {1..10}; do
570-
init_output=$("$tf_path" init -backend=false "${TF_INIT_ARGS[@]}" 2>&1)
571+
init_output=$("$tf_init_path" init -backend=false "${TF_INIT_ARGS[@]}" 2>&1)
571572
exit_code=$?
572573

573574
if [ $exit_code -eq 0 ]; then

0 commit comments

Comments
 (0)