File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 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
44base_code_repository_url : git@github.com:navapbc/platform-test.git
55base_default_region : us-east-1
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ set -euo pipefail
2727# Parse optional parameters
2828environment_variables=" "
2929task_role_arn=" "
30+ workspace_name=" "
3031while : ; 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}"
5661echo " command=${command} "
5762echo " environment_variables=${environment_variables:- } "
5863echo " task_role_arn=${task_role_arn:- } "
64+ echo " workspace_name=${workspace_name:- } "
5965echo
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
6279cluster_name=$( terraform -chdir=" infra/${app_name} /service" output -raw service_cluster_name)
6380service_name=$( terraform -chdir=" infra/${app_name} /service" output -raw service_name)
You can’t perform that action at this time.
0 commit comments