Skip to content

Commit

Permalink
destroy after seed to prevent locking the workspacec
Browse files Browse the repository at this point in the history
  • Loading branch information
italopessoa committed Sep 22, 2024
1 parent d4e0f20 commit 199545d
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,6 @@ jobs:
echo "cluster=$(echo ${{ toJson(steps.workspace-output.outputs.outputs) }} | jq -r '.[] | select(.name == "cluster") | .value')" >> $GITHUB_OUTPUT
echo "host=$(echo ${{ toJson(steps.workspace-output.outputs.outputs) }} | jq -r '.[] | select(.name == "host") | .value')" >> $GITHUB_OUTPUT
destroy-plan:
if: false
name: "Create terraform destroy plan"
needs: [deploy]
runs-on: ubuntu-latest

steps:
- name: Create plan
uses: hashicorp/tfc-workflows-github/actions/[email protected]
id: destroy-plan
with:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ needs.deploy.outputs.config_version }}
is_destroy: true

seed-database:
needs: [deploy]
name: "Seed database"
Expand Down Expand Up @@ -301,3 +286,17 @@ jobs:
id: destroy
run: |
terraform destroy -auto-approve
destroy-plan:
name: "Create terraform destroy plan"
needs: [deploy, seed-database]
runs-on: ubuntu-latest

steps:
- name: Create plan
uses: hashicorp/tfc-workflows-github/actions/[email protected]
id: destroy-plan
with:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ needs.deploy.outputs.config_version }}
is_destroy: true

0 comments on commit 199545d

Please sign in to comment.