From 02e40dbeec9787f210d6e3e1dd62b42c2e354daa Mon Sep 17 00:00:00 2001 From: Benjamin Chiverton Date: Tue, 2 Jul 2024 15:52:58 +0100 Subject: [PATCH 1/4] Update destroy.sh --- .../instance/container_apps_bind_dns/scripts/destroy.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh index acd4b82..1c3d6ac 100644 --- a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh +++ b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh @@ -26,14 +26,13 @@ echo "removed the custom domain from the container app" # wait for the custom domain to be removed tries=0 until [ "$tries" -ge 12 ]; do - DOES_CUSTOM_DOMAIN_EXIST=$( + [[ -z $( az containerapp hostname list \ -n $CONTAINER_APP_NAME \ -g $CONTAINER_APP_RESOURCE_GROUP \ --query "[?name=='$CUSTOM_DOMAIN'].name" \ --output tsv - ) - [[ -z "${$DOES_CUSTOM_DOMAIN_EXIST}" ]] && break + ) ]] && break tries=$((tries + 1)) sleep 10 From 054a7df8af42406dad28e704eb24555f64702324 Mon Sep 17 00:00:00 2001 From: Benjamin Chiverton Date: Tue, 2 Jul 2024 16:14:30 +0100 Subject: [PATCH 2/4] Revert "Update destroy.sh" This reverts commit 02e40dbeec9787f210d6e3e1dd62b42c2e354daa. --- .../instance/container_apps_bind_dns/scripts/destroy.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh index 1c3d6ac..acd4b82 100644 --- a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh +++ b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh @@ -26,13 +26,14 @@ echo "removed the custom domain from the container app" # wait for the custom domain to be removed tries=0 until [ "$tries" -ge 12 ]; do - [[ -z $( + DOES_CUSTOM_DOMAIN_EXIST=$( az containerapp hostname list \ -n $CONTAINER_APP_NAME \ -g $CONTAINER_APP_RESOURCE_GROUP \ --query "[?name=='$CUSTOM_DOMAIN'].name" \ --output tsv - ) ]] && break + ) + [[ -z "${$DOES_CUSTOM_DOMAIN_EXIST}" ]] && break tries=$((tries + 1)) sleep 10 From 86feb6475398ec7877202ebb337c2ea58a1bee1f Mon Sep 17 00:00:00 2001 From: Benjamin Chiverton Date: Tue, 2 Jul 2024 16:14:33 +0100 Subject: [PATCH 3/4] Reapply "Update destroy.sh" This reverts commit 054a7df8af42406dad28e704eb24555f64702324. --- .../instance/container_apps_bind_dns/scripts/destroy.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh index acd4b82..1c3d6ac 100644 --- a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh +++ b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh @@ -26,14 +26,13 @@ echo "removed the custom domain from the container app" # wait for the custom domain to be removed tries=0 until [ "$tries" -ge 12 ]; do - DOES_CUSTOM_DOMAIN_EXIST=$( + [[ -z $( az containerapp hostname list \ -n $CONTAINER_APP_NAME \ -g $CONTAINER_APP_RESOURCE_GROUP \ --query "[?name=='$CUSTOM_DOMAIN'].name" \ --output tsv - ) - [[ -z "${$DOES_CUSTOM_DOMAIN_EXIST}" ]] && break + ) ]] && break tries=$((tries + 1)) sleep 10 From 702bc6f774dcaa72d1b0a2850134c8e3d711119f Mon Sep 17 00:00:00 2001 From: Benjamin Chiverton Date: Tue, 2 Jul 2024 16:15:55 +0100 Subject: [PATCH 4/4] Update destroy.sh --- .../scripts/destroy.sh | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh index 44febdf..a1b8954 100644 --- a/terraform/instance/container_apps_bind_dns/scripts/destroy.sh +++ b/terraform/instance/container_apps_bind_dns/scripts/destroy.sh @@ -39,31 +39,7 @@ CERTIFICATE_ID=$( --managed-certificates-only \ --query "[?properties.subjectName=='$CUSTOM_DOMAIN'].id" \ --output tsv -) - -# remove the custom domain from the container app -az containerapp hostname delete --hostname $CUSTOM_DOMAIN \ - -g $CONTAINER_APP_RESOURCE_GROUP \ - -n $CONTAINER_APP_NAME -echo "removed the custom domain from the container app" - -# wait for the custom domain to be removed -tries=0 -until [ "$tries" -ge 12 ]; do - [[ -z $( - az containerapp hostname list \ - -n $CONTAINER_APP_NAME \ - -g $CONTAINER_APP_RESOURCE_GROUP \ - --query "[?name=='$CUSTOM_DOMAIN'].name" \ - --output tsv - ) ]] && break - tries=$((tries + 1)) - - sleep 10 -done -if [ "$tries" -ge 12 ]; then - die "waited for 2 minutes, checked the containerapp 12 times and it still has the custom domain. check azure portal..." -fi +) # destroy the cert az containerapp env certificate delete \