Skip to content

Commit 6d203d1

Browse files
committed
revert2
1 parent 543fc74 commit 6d203d1

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

azure/azure-pr-teardown-pipeline.yml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,8 @@ jobs:
4848
account_id="$(aws sts get-caller-identity --query Account --output text)"
4949
5050
cd terraform
51-
export WORKSPACE="pr-${ACTION_PR_NUMBER}"
52-
export ENVIRONMENT="$WORKSPACE"
53-
export BUCKET_NAME="immunisation-${WORKSPACE}-terraform-state-files"
54-
55-
# Check if PR state bucket exists
56-
echo "Checking for existence of: s3://${BUCKET_NAME}"
57-
if aws s3api head-bucket --bucket "$BUCKET_NAME" 2>/dev/null; then
58-
echo "Bucket exists. Proceeding with init..."
59-
make init
60-
else
61-
echo "Bucket does NOT exist. Using fallback environment 'internal-dev' for init only.."
62-
export ENVIRONMENT="internal-dev"
63-
export BUCKET_NAME="immunisation-internal-dev-terraform-state-files"
64-
make init
65-
66-
# Restore ENVIRONMENT to PR
67-
export ENVIRONMENT="$WORKSPACE"
68-
export BUCKET_NAME="immunisation-${WORKSPACE}-terraform-state-files"
69-
fi
70-
make destroy aws_account_no=${account_id} environment=$(WORKSPACE)
51+
terraform workspace select $(WORKSPACE)
52+
export ENVIRONMENT=$(WORKSPACE)
53+
make init-reconfigure && make destroy aws_account_no=${account_id} environment=$(WORKSPACE)
7154
displayName: Destroy terraform PR workspace and linked resources
7255
retryCountOnTaskFailure: 2

0 commit comments

Comments
 (0)