Skip to content

Commit b229897

Browse files
committed
feature/PI-407-immutable_backups Variables only needed for source account
1 parent 11d099a commit b229897

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

scripts/infrastructure/terraform/terraform-commands.sh

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,29 @@ function _terraform_plan() {
121121
-var "updated_date=${current_date}" \
122122
-var "expiration_date=${expiration_date}" \
123123
-var "lambdas=${lambdas}" \
124-
-var "workspace_type=${workspace_type}" \
125-
-var "layers=${layers}" \
126-
-var "third_party_layers=${third_party_layers}" || return 1
124+
-var "workspace_type=${workspace_type}" || return 1
127125
else
128-
terraform plan $args \
129-
-out="$plan_file" \
130-
-var-file="$var_file" \
131-
-var "assume_account=${aws_account_id}" \
132-
-var "assume_role=${terraform_role_name}" \
133-
-var "external_id=${external_id}" \
134-
-var "updated_date=${current_date}" \
135-
-var "expiration_date=${expiration_date}" \
136-
-var "layers=${layers}" \
137-
-var "third_party_layers=${third_party_layers}" || return 1
126+
if [[ "${account}" = "dev" ]]; then
127+
terraform plan $args \
128+
-out="$plan_file" \
129+
-var-file="$var_file" \
130+
-var "assume_account=${aws_account_id}" \
131+
-var "assume_role=${terraform_role_name}" \
132+
-var "external_id=${external_id}" \
133+
-var "updated_date=${current_date}" \
134+
-var "expiration_date=${expiration_date}" \
135+
-var "layers=${layers}" \
136+
-var "third_party_layers=${third_party_layers}" || return 1
137+
else
138+
terraform plan $args \
139+
-out="$plan_file" \
140+
-var-file="$var_file" \
141+
-var "assume_account=${aws_account_id}" \
142+
-var "assume_role=${terraform_role_name}" \
143+
-var "external_id=${external_id}" \
144+
-var "updated_date=${current_date}" \
145+
-var "expiration_date=${expiration_date}" || return 1
146+
fi
138147
fi
139148
}
140149

0 commit comments

Comments
 (0)