Skip to content

Destroy

Destroy #84

Workflow file for this run

name: Destroy
on:
workflow_dispatch:
env:
TF_VAR_load_balancer_listener_arn: "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/dummy-target-group/1234567890123456"
TF_VAR_ecr_repository_name: ${{ github.event.repository.name }}
permissions:
id-token: write
contents: read
jobs:
service:
runs-on: ubuntu-latest
env:
TF_VAR_task_definition_arn: "arn:aws:ecs:us-east-1:123456789012:task-definition/dummy-task-definition"
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.aws_region }}
role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
role-session-name: GitHubActions
- name: Init
shell: bash
run: |
cd tf/service
terraform init
- name: Destroy
shell: bash
id: destroy
run: |
cd tf/service
terraform destroy -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars
task:
needs: service
runs-on: ubuntu-latest
env:
TF_VAR_image_uri: dummy
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.aws_region }}
role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
role-session-name: GitHubActions
- name: Init
shell: bash
run: |
cd tf/task
terraform init
- name: Destroy
shell: bash
id: destroy
run: |
cd tf/task
terraform destroy -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars
ecr:
needs: task
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.aws_region }}
role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
role-session-name: GitHubActions
- name: Init
shell: bash
run: |
cd tf/ecr
terraform init
- name: Destroy
shell: bash
id: destroy
run: |
cd tf/ecr
terraform destroy -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars
network:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.aws_region }}
role-to-assume: arn:aws:iam::${{ vars.aws_account_id }}:role/${{ vars.aws_role }}
role-session-name: GitHubActions
- name: Init
shell: bash
run: |
cd tf/network
terraform init
- name: Destroy
shell: bash
id: destroy
run: |
cd tf/network
terraform destroy -auto-approve -var-file=${{ github.workspace }}/tf/variables.tfvars