From e3b68d56afc22b5c2e977cc97ea3db8099aff2a0 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 5 Jul 2023 19:23:03 +0100 Subject: [PATCH] Handle issue with workspace already existing --- .github/workflows/deploy_terraform.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_terraform.yml b/.github/workflows/deploy_terraform.yml index 8dacab29..2a1bfa14 100644 --- a/.github/workflows/deploy_terraform.yml +++ b/.github/workflows/deploy_terraform.yml @@ -52,7 +52,9 @@ jobs: run: cd infrastructure/terraform && terraform plan -var-file=${{ github.event.pull_request.base.ref }}.tfvars - name: Terraform Workspace - run: cd infrastructure/terraform && terraform workspace new ${{ github.event.pull_request.base.ref }} + run: | + cd infrastructure/terraform + terraform workspace select ${{ github.event.pull_request.base.ref }} || terraform workspace new ${{ github.event.pull_request.base.ref }} - name: Deploy to Dev if: github.event.pull_request.base.ref == 'dev' && github.event.pull_request.merged == true