Skip to content

PANIC - destroy infrastructure #1

PANIC - destroy infrastructure

PANIC - destroy infrastructure #1

Workflow file for this run

name: PANIC - destroy infrastructure
on:
workflow_dispatch:
inputs:
deployment_env:
description: 'Environment to destroy'
required: true
type: choice
options:
- stg
- prd
confirmation:
description: 'Type "DESTROY" to confirm'
required: true
type: string
jobs:
destroy-infrastructure:
runs-on: ubuntu-latest
environment: ${{ inputs.deployment_env }}
steps:
- name: Validate confirmation
run: |
if [ "${{ github.event.inputs.confirmation }}" != "DESTROY" ]; then
exit 1
fi
- uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Auth GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Init Terraform
working-directory: terraform
run: terraform init
- name: Use deployment env workspace
working-directory: terraform
run: terraform workspace select ${{ inputs.deployment_env }}
- name: Destroy infrastructure
working-directory: terraform
run: terraform destroy -auto-approve