@@ -5,6 +5,9 @@ source ./scripts/infrastructure/terraform/terraform-constants.sh
55
66PATH_TO_HERE=" scripts/infrastructure/apigee"
77APIGEE_DEPLOYMENT_ROLE=" NHSDeploymentRole"
8+ PERSISTENT_ENVIRONMENT_BUILD=" ${2:- false} "
9+ API_NAME=" connecting-party-manager"
10+
811
912
1013if [[ -z ${WORKSPACE_OUTPUT_JSON} ]]; then
@@ -89,7 +92,12 @@ function attach_product(){
8992 _org_name=" nhsd-nonprod"
9093 # Currently hardcoded to CPM PTL id for PR running purposes, could be passed in for adjusting other apps in the future
9194 _app_id=" 9d28b416-311b-4523-bda9-686baa2fc437"
92- _product_name=" connecting-party-manager--$_apigee_environment --cpm-$_workspace_name --app-level0"
95+
96+ if [ " $PERSISTENT_ENVIRONMENT_BUILD " = " false" ]; then
97+ API_NAME=$_workspace_name
98+ fi
99+
100+ _product_name=" connecting-party-manager--$_apigee_environment --$API_NAME --app-level0"
93101 _secret_name=" $_aws_environment --apigee-app-client-info"
94102 _apigee_stage=$( get_apigee_stage ${_workspace_name} )
95103
@@ -146,7 +154,6 @@ function attach_product(){
146154 -H " Content-type:application/json" \
147155 -d " {\" apiProducts\" : [\" $_product_name \" ]}" )
148156
149- echo " $add_product_response "
150157 status=$( echo " $add_product_response " | jq -r ' .status' )
151158 echo " $status "
152159
@@ -171,7 +178,12 @@ function detach_product(){
171178 _org_name=" nhsd-nonprod"
172179 # Currently hardcoded to CPM PTL id for PR running purposes, could be passed in for adjusting other apps in the future
173180 _app_id=" 9d28b416-311b-4523-bda9-686baa2fc437"
174- _product_name=" connecting-party-manager--$_apigee_environment --cpm-$_workspace_name --app-level0"
181+
182+ if [ " $PERSISTENT_ENVIRONMENT_BUILD " = " false" ]; then
183+ API_NAME=$_workspace_name
184+ fi
185+
186+ _product_name=" connecting-party-manager--$_apigee_environment --$API_NAME --app-level0"
175187 _secret_name=" $_aws_environment --apigee-app-client-info"
176188 _apigee_stage=$( get_apigee_stage ${_workspace_name} )
177189
@@ -228,7 +240,6 @@ function detach_product(){
228240 -H " Content-type:application/json" \
229241 -d " {\" apiProducts\" : [\" $_product_name \" ]}" )
230242
231- echo " $detach_product_response "
232243 status=$( echo " $detach_product_response " | jq -r ' .status' )
233244 echo " $status "
234245
0 commit comments