Skip to content

Destroy

Destroy #88

Workflow file for this run

name: Destroy
on:
workflow_dispatch:
env:
TF_VAR_task_definition_arn: "arn:aws:ecs:${{ vars.aws_region }}:123456789012:task-definition/dummy-task-definition"
TF_VAR_load_balancer_arn: "arn:aws:elasticloadbalancing:${{ vars.aws_region }}:123456789012:loadbalancer/app/dummy/50dc6c495c0c9188"
TF_VAR_lb_listener_arn: "arn:aws:elasticloadbalancing:${{ vars.aws_region }}:123456789012:listener/app/dummy/50dc6c495c0c9188/9f512f9a12e6c2ed"
TF_VAR_lb_blue_target_group: "dummy-target-group"
TF_VAR_lb_blue_target_group_arn: "arn:aws:elasticloadbalancing:${{ vars.aws_region }}:123456789012:targetgroup/dummy/6d0ecf831eec9f09"
TF_VAR_lb_green_target_group: "dummy-target-group"
TF_VAR_lb_green_target_group_arn: "arn:aws:elasticloadbalancing:${{ vars.aws_region }}:123456789012:targetgroup/dummy/6d0ecf831eec9f09"
TF_VAR_ecr_repository_name: ${{ github.event.repository.name }}
permissions:
id-token: write
contents: read
jobs:
service:
runs-on: ubuntu-latest
env:
TF_VAR_load_balancer_listener_arn: "arn:aws:elasticloadbalancing:${{ vars.aws_region }}:123456789012:targetgroup/dummy-target-group/1234567890123456"
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