File tree Expand file tree Collapse file tree
function-app-managed-identity/python/terraform
function-app-storage-http/dotnet/terraform
web-app-cosmosdb-mongodb-api/python/terraform
web-app-managed-identity/python/terraform
web-app-sql-database/python/terraform Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,17 @@ export TF_LOG_PATH="$CURRENT_DIR/terraform-debug.log"
5757echo " [DEBUG] Checking what tflocal does..." echo " [DEBUG] tflocal version: $( $TERRAFORM version 2>&1 | head -1) " echo " [DEBUG] Contents of current directory before init:" ls -la . 2>&1 | head -20
5858echo " [DEBUG] Terraform debug logging enabled: TF_LOG=DEBUG, TF_LOG_PATH=$TF_LOG_PATH "
5959
60+ # Clean up any existing Terraform state from previous runs
61+ if [[ $ENVIRONMENT == " LocalStack" ]]; then
62+ echo " Cleaning up any existing resources from previous runs..."
63+ if [ -f " .terraform/terraform.tfstate" ] || [ -f " terraform.tfstate" ]; then
64+ $TERRAFORM init -upgrade 2> /dev/null || true
65+ $TERRAFORM destroy -auto-approve 2> /dev/null || true
66+ rm -f terraform.tfstate* tfplan .terraform.lock.hcl 2> /dev/null || true
67+ rm -rf .terraform 2> /dev/null || true
68+ fi
69+ fi
70+
6071echo " Initializing Terraform..."
6172$TERRAFORM init -upgrade
6273
132143if [ -f " $ZIPFILE " ]; then
133144 rm " $ZIPFILE "
134145fi
135-
136- # Clean up Terraform resources
137- echo " Cleaning up Terraform resources..."
138- cd " $CURRENT_DIR " || exit
139- $TERRAFORM destroy -auto-approve
Original file line number Diff line number Diff line change @@ -56,6 +56,17 @@ export TF_LOG_PATH="$CURRENT_DIR/terraform-debug.log"
5656echo " [DEBUG] Checking what tflocal does..." echo " [DEBUG] tflocal version: $( $TERRAFORM version 2>&1 | head -1) " echo " [DEBUG] Contents of current directory before init:" ls -la . 2>&1 | head -20
5757echo " [DEBUG] Terraform debug logging enabled: TF_LOG=DEBUG, TF_LOG_PATH=$TF_LOG_PATH "
5858
59+ # Clean up any existing Terraform state from previous runs
60+ if [[ $ENVIRONMENT == " LocalStack" ]]; then
61+ echo " Cleaning up any existing resources from previous runs..."
62+ if [ -f " .terraform/terraform.tfstate" ] || [ -f " terraform.tfstate" ]; then
63+ $TERRAFORM init -upgrade 2> /dev/null || true
64+ $TERRAFORM destroy -auto-approve 2> /dev/null || true
65+ rm -f terraform.tfstate* tfplan .terraform.lock.hcl 2> /dev/null || true
66+ rm -rf .terraform 2> /dev/null || true
67+ fi
68+ fi
69+
5970echo " Initializing Terraform..."
6071$TERRAFORM init -upgrade
6172
@@ -115,8 +126,3 @@ $AZ functionapp deploy \
115126 --name " $FUNCTION_APP_NAME " \
116127 --src-path $ZIPFILE \
117128 --type zip 1> /dev/null
118-
119- # Clean up Terraform resources
120- echo " Cleaning up Terraform resources..."
121- cd " $CURRENT_DIR " || exit
122- $TERRAFORM destroy -auto-approve
Original file line number Diff line number Diff line change @@ -56,6 +56,17 @@ export TF_LOG_PATH="$CURRENT_DIR/terraform-debug.log"
5656echo " [DEBUG] Checking what tflocal does..." echo " [DEBUG] tflocal version: $( $TERRAFORM version 2>&1 | head -1) " echo " [DEBUG] Contents of current directory before init:" ls -la . 2>&1 | head -20
5757echo " [DEBUG] Terraform debug logging enabled: TF_LOG=DEBUG, TF_LOG_PATH=$TF_LOG_PATH "
5858
59+ # Clean up any existing Terraform state from previous runs
60+ if [[ $ENVIRONMENT == " LocalStack" ]]; then
61+ echo " Cleaning up any existing resources from previous runs..."
62+ if [ -f " .terraform/terraform.tfstate" ] || [ -f " terraform.tfstate" ]; then
63+ $TERRAFORM init -upgrade 2> /dev/null || true
64+ $TERRAFORM destroy -auto-approve 2> /dev/null || true
65+ rm -f terraform.tfstate* tfplan .terraform.lock.hcl 2> /dev/null || true
66+ rm -rf .terraform 2> /dev/null || true
67+ fi
68+ fi
69+
5970echo " Initializing Terraform..."
6071$TERRAFORM init -upgrade
6172
@@ -118,8 +129,3 @@ $AZ webapp deploy \
118129if [ -f " $ZIPFILE " ]; then
119130 rm " $ZIPFILE "
120131fi
121-
122- # Clean up Terraform resources
123- echo " Cleaning up Terraform resources..."
124- cd " $CURRENT_DIR " || exit
125- $TERRAFORM destroy -auto-approve
Original file line number Diff line number Diff line change @@ -57,6 +57,17 @@ export TF_LOG_PATH="$CURRENT_DIR/terraform-debug.log"
5757echo " [DEBUG] Checking what tflocal does..." echo " [DEBUG] tflocal version: $( $TERRAFORM version 2>&1 | head -1) " echo " [DEBUG] Contents of current directory before init:" ls -la . 2>&1 | head -20
5858echo " [DEBUG] Terraform debug logging enabled: TF_LOG=DEBUG, TF_LOG_PATH=$TF_LOG_PATH "
5959
60+ # Clean up any existing Terraform state from previous runs
61+ if [[ $ENVIRONMENT == " LocalStack" ]]; then
62+ echo " Cleaning up any existing resources from previous runs..."
63+ if [ -f " .terraform/terraform.tfstate" ] || [ -f " terraform.tfstate" ]; then
64+ $TERRAFORM init -upgrade 2> /dev/null || true
65+ $TERRAFORM destroy -auto-approve 2> /dev/null || true
66+ rm -f terraform.tfstate* tfplan .terraform.lock.hcl 2> /dev/null || true
67+ rm -rf .terraform 2> /dev/null || true
68+ fi
69+ fi
70+
6071echo " Initializing Terraform..."
6172$TERRAFORM init -upgrade
6273
130141if [ -f " $ZIPFILE " ]; then
131142 rm " $ZIPFILE "
132143fi
133-
134- # Clean up Terraform resources
135- echo " Cleaning up Terraform resources..."
136- cd " $CURRENT_DIR " || exit
137- $TERRAFORM destroy -auto-approve
Original file line number Diff line number Diff line change @@ -61,6 +61,17 @@ export TF_LOG_PATH="$CURRENT_DIR/terraform-debug.log"
6161echo " [DEBUG] Checking what tflocal does..." echo " [DEBUG] tflocal version: $( $TERRAFORM version 2>&1 | head -1) " echo " [DEBUG] Contents of current directory before init:" ls -la . 2>&1 | head -20
6262echo " [DEBUG] Terraform debug logging enabled: TF_LOG=DEBUG, TF_LOG_PATH=$TF_LOG_PATH "
6363
64+ # Clean up any existing Terraform state from previous runs
65+ if [[ $ENVIRONMENT == " LocalStack" ]]; then
66+ echo " Cleaning up any existing resources from previous runs..."
67+ if [ -f " .terraform/terraform.tfstate" ] || [ -f " terraform.tfstate" ]; then
68+ $TERRAFORM init -upgrade 2> /dev/null || true
69+ $TERRAFORM destroy -auto-approve 2> /dev/null || true
70+ rm -f terraform.tfstate* tfplan .terraform.lock.hcl 2> /dev/null || true
71+ rm -rf .terraform 2> /dev/null || true
72+ fi
73+ fi
74+
6475echo " Initializing Terraform..."
6576$TERRAFORM init -upgrade
6677
288299if [ -f " $ZIPFILE " ]; then
289300 rm " $ZIPFILE "
290301fi
291-
292- # Clean up Terraform resources
293- echo " Cleaning up Terraform resources..."
294- cd " $CURRENT_DIR " || exit
295- $TERRAFORM destroy -auto-approve
You can’t perform that action at this time.
0 commit comments