Skip to content

Destroy Server

Destroy Server #185

name: Destroy Server
on:
schedule:
- cron: "0 16 * * *" # run once a day at 12 AM (philippine standard time)
workflow_dispatch:
defaults:
run:
working-directory: ./terraform
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Init
run: terraform init
- name: Terraform Validate
run: terraform validate
- run: echo "DROPLET_SIZE=$(terraform output -json | jq -r '.droplet_size.value // empty')" >> $GITHUB_ENV
- name: Terraform Destroy
run: terraform destroy -auto-approve
env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
TF_VAR_droplet_size: ${{ env.DROPLET_SIZE }}