diff --git a/scripts/infrastructure/terraform/terraform-commands.sh b/scripts/infrastructure/terraform/terraform-commands.sh index d474473e3..c5ec8b55a 100644 --- a/scripts/infrastructure/terraform/terraform-commands.sh +++ b/scripts/infrastructure/terraform/terraform-commands.sh @@ -128,18 +128,18 @@ function _terraform_plan() { -var "assume_role=${TERRAFORM_ROLE_NAME}" \ -var "updated_date=${current_date}" \ -var "expiration_date=${expiration_date}" || return 1 + else + terraform plan \ + -out="$plan_file" \ + -var-file="$var_file" \ + -var "assume_account=${aws_account_id}" \ + -var "assume_role=${TERRAFORM_ROLE_NAME}" \ + -var "updated_date=${current_date}" \ + -var "expiration_date=${expiration_date}" \ + -var "lambdas=${lambdas}" \ + -var "workspace_type=${workspace_type}" \ + -var "layers=${layers}" || return 1 fi - - terraform plan \ - -out="$plan_file" \ - -var-file="$var_file" \ - -var "assume_account=${aws_account_id}" \ - -var "assume_role=${TERRAFORM_ROLE_NAME}" \ - -var "updated_date=${current_date}" \ - -var "expiration_date=${expiration_date}" \ - -var "lambdas=${lambdas}" \ - -var "workspace_type=${workspace_type}" \ - -var "layers=${layers}" || return 1 } function _terraform_apply() { @@ -168,17 +168,17 @@ function _terraform_destroy() { -var "assume_account=${aws_account_id}" \ -var "assume_role=${TERRAFORM_ROLE_NAME}" \ $args || return 1 + else + terraform destroy \ + -var-file="$var_file" \ + -var "assume_account=${aws_account_id}" \ + -var "assume_role=${TERRAFORM_ROLE_NAME}" \ + -var "workspace_type=${workspace_type}" \ + -var "lambdas=${lambdas}" \ + -var "layers=${layers}" \ + $args || return 1 fi - terraform destroy \ - -var-file="$var_file" \ - -var "assume_account=${aws_account_id}" \ - -var "assume_role=${TERRAFORM_ROLE_NAME}" \ - -var "workspace_type=${workspace_type}" \ - -var "lambdas=${lambdas}" \ - -var "layers=${layers}" \ - $args || return 1 - if [ "$workspace" != "default" ]; then terraform workspace select default || return 1 terraform workspace delete "$workspace" || return 1