Skip to content

destroy

destroy #6

name: destroy
on:
workflow_dispatch:
jobs:
destroy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: actions/cache@v3
with:
path: |
.terraform/**
.terraform.lock.hcl
plan.cache
key: terraform-lock-${{ github.event.workflow_run.head_branch }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY}}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY}}
aws-region: ${{ secrets.AWS_REGION }}
- name: Terraform Init
id: init
run: |
cat main.tf
terraform init -reconfigure
- name: Terraform destroy
run: terraform destroy -auto-approve