diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index d635303..6ebc037 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -133,7 +133,7 @@ jobs: body: output }); - terraform-apply: + deploy: if: github.ref == 'refs/heads/main' needs: [test] name: "Terraform Apply" @@ -141,6 +141,8 @@ jobs: environment: dev permissions: contents: read + outputs: + CONFIG_VERSION: ${{ steps.apply-upload.outputs.configuration_version_id }} steps: - name: Checkout uses: actions/checkout@v4 @@ -173,4 +175,19 @@ jobs: id: apply with: run: ${{ steps.apply-run.outputs.run_id }} - comment: "Confirmed from GitHub Actions CI ${{ github.sha }}" \ No newline at end of file + comment: "Confirmed from GitHub Actions CI ${{ github.sha }}" + + destroy-plan: + name: "Create terraform destroy plan" + needs: [deploy] + runs-on: ubuntu-latest + + steps: + - name: Create plan + uses: hashicorp/tfc-workflows-github/actions/create-run@v1.3.1 + id: destroy-plan + with: + workspace: ${{ env.TF_WORKSPACE }} + configuration_version: ${{ needs.deploy.outputs.CONFIG_VERSION }} + is_destroy: true + \ No newline at end of file