From 5e3b83180de09b1dd7a595e02f8cc6a8ddb87c6e Mon Sep 17 00:00:00 2001 From: Musa Date: Mon, 10 Feb 2025 10:09:16 -0500 Subject: [PATCH] Fix terraform destroy for ec2 integration tests (#1535) --- .github/workflows/ec2-integration-test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index 5d1eb6245c..158499d471 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -123,4 +123,11 @@ jobs: max_attempts: 2 timeout_minutes: 8 retry_wait_seconds: 5 - command: cd ${{ inputs.test_dir }} && terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve \ No newline at end of file + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd ${{inputs.test_dir}} + fi + + terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve \ No newline at end of file