diff --git a/Makefile b/Makefile index c6b1cd4aa..6416edd28 100644 --- a/Makefile +++ b/Makefile @@ -178,9 +178,7 @@ tre-destroy: && . ./devops/scripts/check_dependencies.sh nodocker \ && . ./devops/scripts/load_env.sh ./templates/core/.env \ && . ./devops/scripts/load_env.sh ./devops/.env \ - && . ./devops/scripts/load_terraform_env.sh ./devops/.env \ - && . ./devops/scripts/load_terraform_env.sh ./templates/core/.env \ - && cd ./templates/core/terraform/ && ./destroy.sh + && . ./devops/scripts/destroy_env_no_terraform.sh terraform-deploy: $(call target_title, "Deploying ${DIR} with Terraform") \ diff --git a/devops/scripts/control_tre.sh b/devops/scripts/control_tre.sh index 0d21fa5fc..0ea857b69 100755 --- a/devops/scripts/control_tre.sh +++ b/devops/scripts/control_tre.sh @@ -56,11 +56,12 @@ elif [[ "$1" == *"stop"* ]]; then fi # Report final FW status -PUBLIC_IP=$(az network firewall ip-config list -f "fw-$TRE_ID" -g "rg-$TRE_ID" --query "[0].publicIpAddress" -o tsv) -if [ -n "$PUBLIC_IP" ]; then - FW_STATE="Running" -else - FW_STATE="Stopped" +FW_STATE="Stopped" +if [[ $(az network firewall list --query "[?resourceGroup=='rg-${TRE_ID}'&&name=='fw-${TRE_ID}'] | length(@)") != 0 ]]; then + PUBLIC_IP=$(az network firewall ip-config list -f "fw-$TRE_ID" -g "rg-$TRE_ID" --query "[0].publicIpAddress" -o tsv) + if [ -n "$PUBLIC_IP" ]; then + FW_STATE="Running" + fi fi # Report final AGW status diff --git a/devops/scripts/destroy_env_no_terraform.sh b/devops/scripts/destroy_env_no_terraform.sh index 83cff40dd..8aecb6669 100755 --- a/devops/scripts/destroy_env_no_terraform.sh +++ b/devops/scripts/destroy_env_no_terraform.sh @@ -23,11 +23,6 @@ USAGE exit 1 } -# if no arguments are provided, return usage function -if [ $# -eq 0 ]; then - usage # run usage function -fi - no_wait=false while [ "$1" != "" ]; do @@ -96,7 +91,7 @@ az resource list --resource-group ${core_tre_rg} --query '[].[id]' -o tsv | xarg # purge keyvault if possible (makes it possible to reuse the same tre_id later) # this has to be done before we delete the resource group since we don't wait for it to complete -if [[ $(az keyvault list --resource-group ${core_tre_rg} --query '[?proterties.enablePurgeProtection==null] | length (@)') != 0 ]]; then +if [[ $(az keyvault list --resource-group ${core_tre_rg} --query '[?properties.enablePurgeProtection==null] | length (@)') != 0 ]]; then tre_id=${core_tre_rg#"rg-"} keyvault_name="kv-${tre_id}"