diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index e8eb613..bde036d 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -66,16 +66,26 @@ jobs: id: validate run: terraform validate -no-color + - name: Terraform Plan + id: plan + if: github.event_name == 'pull_request' + run: terraform plan -no-color -out=${{ vars.plan_cache }}/${{ github.sha }} + continue-on-error: true + - name: Terraform Plan id: plan run: terraform plan -no-color continue-on-error: true + - name: Terraform Show plan + if: github.event_name == 'pull_request' + run: echo ::set-output name=terraform_plan::$(terraform show ${{ vars.plan_cache }}/${{ github.sha }}) + - name: Post Terraform Plan to PR uses: CSVD/gh-actions-github-script@v6 if: github.event_name == 'pull_request' env: - PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + PLAN: "terraform\n${{ env.terraform_plan }}" with: github-token: ${{ secrets.GH_TOKEN }} script: |