@@ -10,15 +10,22 @@ DATABASE_USER_NAME='testuser'
1010DATABASE_USER_PASSWORD=' TestP@ssw0rd123'
1111CURRENT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
1212ZIPFILE=" planner_website.zip"
13- ENVIRONMENT=$( az account show --query environmentName --output tsv)
1413DEPLOY_APP=1
1514
1615# Change the current directory to the script's directory
1716cd " $CURRENT_DIR " || exit
1817
18+ # Determine environment - check if azlocal is configured first
19+ ENVIRONMENT=$( azlocal account show --query environmentName --output tsv 2> /dev/null || echo " " )
20+
21+ if [[ -z " $ENVIRONMENT " ]]; then
22+ # Try with regular az if azlocal failed
23+ ENVIRONMENT=$( az account show --query environmentName --output tsv 2> /dev/null || echo " AzureCloud" )
24+ fi
25+
1926# Run terraform init and apply
2027if [[ $ENVIRONMENT == " LocalStack" ]]; then
21- echo " Using tflocal and azlocal for LocalStack emulator environment and ."
28+ echo " Using tflocal and azlocal for LocalStack emulator environment."
2229 TERRAFORM=" tflocal"
2330 AZ=" azlocal"
2431else
@@ -56,10 +63,10 @@ if [[ $? != 0 ]]; then
5663fi
5764
5865# Get the output values
59- RESOURCE_GROUP_NAME=$( terraform output -raw resource_group_name)
60- WEB_APP_NAME=$( terraform output -raw web_app_name)
61- SQL_SERVER_NAME=$( terraform output -raw sql_server_name)
62- SQL_DATABASE_NAME=$( terraform output -raw sql_database_name)
66+ RESOURCE_GROUP_NAME=$( $TERRAFORM output -raw resource_group_name)
67+ WEB_APP_NAME=$( $TERRAFORM output -raw web_app_name)
68+ SQL_SERVER_NAME=$( $TERRAFORM output -raw sql_server_name)
69+ SQL_DATABASE_NAME=$( $TERRAFORM output -raw sql_database_name)
6370
6471if [[ -z " $WEB_APP_NAME " || -z " $SQL_SERVER_NAME " || -z " $SQL_DATABASE_NAME " ]]; then
6572 echo " Web App Name, SQL Server Name, or SQL Database Name is empty. Exiting."
0 commit comments