Skip to content

Destroy hetzner infra #26

Destroy hetzner infra

Destroy hetzner infra #26

name: Hetzner Destroy
run-name: Destroy hetzner infra
on: workflow_dispatch
env:
BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE}}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
terraform:
name: Destroy Hetzner Infra
runs-on: ubuntu-latest
steps:
- run: echo "Job is running on ${{ runner.os }}"
- run: echo "Branch name is ${{ github.ref }} and repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- name: HashiCorp - Setup Terraform
uses: hashicorp/[email protected]
- name: Terraform init
id: init
run: terraform init -backend-config="bucket=$BUCKET_TF_STATE"
working-directory: hetzner
- name: Terraform validate
id: validate
run: terraform validate
working-directory: hetzner
- name: Terraform Destroy
run: terraform destroy -auto-approve -input=false -var "hcloud_token=${{ secrets.HCLOUD_TOKEN }}" -var "tailscale_key=${{ secrets.TAILSCALE_KEY }}"
working-directory: hetzner
- run: echo "Job is ${{ job.status }}."