Skip to content

Destroy Server

Destroy Server #27

name: Destroy DigitalOcean Droplet
on:
schedule:
- cron: "0 16 * * *" # run once a day at 12 AM (philippine standard time)
workflow_dispatch:
inputs:
size:
description: droplet size
type: choice
default: s-1vcpu-1gb
options:
- s-1vcpu-1gb
- s-1vcpu-1gb-amd
- s-1vcpu-2gb
- s-1vcpu-2gb-amd
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
- name: Terraform Destroy
run: terraform destroy -auto-approve
env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
TF_VAR_droplet_size: ${{ inputs.size }}