Skip to content

Commit

Permalink
Merge pull request #278 from dxw/fix-run-terraform-command-var-file-p…
Browse files Browse the repository at this point in the history
…arameters

Fix run-terraform-command `-var-file` parameter placement
  • Loading branch information
Stretch96 authored May 21, 2024
2 parents f57f3a7 + 273697a commit 31b9c62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/terraform-dependencies/run-terraform-command
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,18 @@ CHECK_COMMANDS=(
"plan"
"apply"
"console"
"import"
)
if [[
"${CHECK_COMMANDS[*]}" =~ $(echo "${OPTIONS[0]}" | cut -d' ' -f1 ) &&
-n "$CURRENT_WORKSPACE" &&
"$CURRENT_WORKSPACE" != "default"
]]
then
FIRST_OPTION=$(echo "${OPTIONS[0]}" | cut -d' ' -f1)
POST_OPTIONS=$(echo "${OPTIONS[0]}" | cut -d' ' -f2-)
OPTIONS=()
OPTIONS+=("$FIRST_OPTION")
if [ "$TERRAFORM_PROJECT" == "account-bootstrap" ]
then
ACCOUNT_NAME=$(echo "$CURRENT_WORKSPACE" | cut -d'-' -f5-)
Expand Down Expand Up @@ -114,6 +119,7 @@ then
OPTIONS+=("-var-file=$CONFIG_TFVARS_DIR/000-terraform.tfvars")
OPTIONS+=("-var-file=$CONFIG_TFVARS_DIR/200-$CURRENT_WORKSPACE.tfvars")
fi
OPTIONS+=("${POST_OPTIONS[@]}")
fi

if [ "$QUIET_MODE" == 0 ]
Expand Down

0 comments on commit 31b9c62

Please sign in to comment.