Skip to content

Destroy environment #21

Destroy environment

Destroy environment #21

Workflow file for this run

name: Destroy environment
on:
workflow_dispatch:
inputs:
env:
description: select the environment to destroy
type: environment
required: true
env:
TF_VERSION: 1.2.2
TG_VERSION: 0.37.1
TG_SRC_PATH: terraform
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
tf_destroy:
name: Destroy the selected environment
environment: ${{ inputs.env }}
runs-on: ubuntu-20.04
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ vars.TERRAFORM_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.TF_VERSION }}
- uses: autero1/[email protected]
with:
terragrunt_version: ${{ env.TG_VERSION }}
- name: Terragrunt destroy
working-directory: ${{ env.TG_SRC_PATH }}/${{ env.TFC_WORKSPACE }}
env:
job_env: "${{ inputs.env }}"
AWS_ACCOUNTS_ECR_READ_ACCESS: ${{ secrets.AWS_ACCOUNTS_ECR_READ_ACCESS }}
LICENSE_PLATE: ${{ vars.LICENSE_PLATE }}
run: |
cd $job_env
terragrunt run-all destroy --terragrunt-non-interactive