Skip to content

Commit d9f603a

Browse files
Update template-infra:base to version 0.15.3.post3.dev0+5cc1f4d
1 parent 41328b3 commit d9f603a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.template-infra/base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.15.3-2-g8d7ab07
2+
_commit: v0.15.3-3-g5cc1f4d
33
_src_path: https://github.com/navapbc/template-infra
44
base_code_repository_url: git@github.com:navapbc/platform-test.git
55
base_default_region: us-east-1

bin/run-command

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ set -euo pipefail
2727
# Parse optional parameters
2828
environment_variables=""
2929
task_role_arn=""
30+
workspace_name=""
3031
while :; do
3132
case "$1" in
3233
--environment-variables)
@@ -37,6 +38,10 @@ while :; do
3738
task_role_arn="$2"
3839
shift 2
3940
;;
41+
--workspace)
42+
workspace_name="$2"
43+
shift 2
44+
;;
4045
*)
4146
break
4247
;;
@@ -56,8 +61,20 @@ echo " environment=${environment}"
5661
echo " command=${command}"
5762
echo " environment_variables=${environment_variables:-}"
5863
echo " task_role_arn=${task_role_arn:-}"
64+
echo " workspace_name=${workspace_name:-}"
5965
echo
6066

67+
# Initialize terraform and select workspace if specified
68+
./bin/terraform-init "infra/${app_name}/service" "${environment}"
69+
70+
if [ -n "${workspace_name}" ]; then
71+
# Set up trap to restore workspace on script exit
72+
original_workspace=$(terraform -chdir="infra/${app_name}/service" workspace show)
73+
trap 'terraform -chdir="infra/${app_name}/service" workspace select "${original_workspace}"' EXIT
74+
75+
terraform -chdir="infra/${app_name}/service" workspace select "${workspace_name}"
76+
fi
77+
6178
# Use the same cluster, task definition, and network configuration that the application service uses
6279
cluster_name=$(terraform -chdir="infra/${app_name}/service" output -raw service_cluster_name)
6380
service_name=$(terraform -chdir="infra/${app_name}/service" output -raw service_name)

0 commit comments

Comments
 (0)