-
Notifications
You must be signed in to change notification settings - Fork 25
43 lines (37 loc) · 1.4 KB
/
delete_all_resources.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: 3 Delete ECS Cluster, Prefect agent ECS service and ECR repository
on:
workflow_dispatch:
inputs:
aws-region:
description: AWS Region
required: true
default: 'us-east-1'
type: string
env:
PROJECT: dataflowops
AWS_REGION: ${{ github.event.inputs.aws-region }}
jobs:
delete-stack:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Delete ECR repository
continue-on-error: true
run: |
aws ecr delete-repository --repository-name ${{ env.PROJECT }} --force
aws cloudformation delete-stack --stack-name "${{ env.PROJECT }}-ecr"
aws cloudformation wait stack-delete-complete --stack-name "${{ env.PROJECT }}-ecr"
- name: Delete ECS agent service
continue-on-error: true
run: |
aws cloudformation delete-stack --stack-name ${{ env.PROJECT }}
aws cloudformation wait stack-delete-complete --stack-name ${{ env.PROJECT }}
- name: All AWS resources deleted
run: echo '### All AWS resources deleted! :tada:' >> $GITHUB_STEP_SUMMARY