From 53d549774f002e6d4841932ecf5354448aaf6bbc Mon Sep 17 00:00:00 2001 From: John Collinson <13622412+johncollinson2001@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:26:24 +0100 Subject: [PATCH] Refine tf state variable access. --- .github/workflows/ci-pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yaml b/.github/workflows/ci-pipeline.yaml index 863f91f..b257179 100644 --- a/.github/workflows/ci-pipeline.yaml +++ b/.github/workflows/ci-pipeline.yaml @@ -29,6 +29,7 @@ jobs: - name: Terraform Init run: | + BRANCH_NAME="${{ github.head_ref != '' && github.head_ref || github.ref }}" TF_STATE_KEY="${BRANCH_NAME//\//_}.tfstate" terraform init -backend=true -backend-config="resource_group_name=$TF_STATE_RESOURCE_GROUP" -backend-config="storage_account_name=$TF_STATE_STORAGE_ACCOUNT" -backend-config="container_name=github-actions" -backend-config="key=$TF_STATE_KEY" working-directory: infrastructure @@ -39,7 +40,6 @@ jobs: ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} TF_STATE_RESOURCE_GROUP: ${{ secrets.TF_STATE_RESOURCE_GROUP }} TF_STATE_STORAGE_ACCOUNT: ${{ secrets.TF_STATE_STORAGE_ACCOUNT }} - BRANCH_NAME: ${{ github.head_ref != '' && github.head_ref || github.ref }} - name: Terraform Validate run: terraform validate