-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (47 loc) · 2.03 KB
/
delete_all_resources.yml
File metadata and controls
55 lines (47 loc) · 2.03 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
name: 3 Delete EKS Cluster, Prefect agent and ECR repository
on:
workflow_dispatch:
inputs:
aws-region:
description: AWS Region to deploy all resources to
required: true
default: 'us-east-1'
type: string
env:
PROJECT: prod
AWS_DEFAULT_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
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_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 EKS node group
continue-on-error: true
run: |
aws cloudformation delete-stack --stack-name eksctl-prefect-nodegroup-prefect-ng-1
aws cloudformation wait stack-delete-complete --stack-name eksctl-prefect-nodegroup-prefect-ng-1
- name: Delete EKS IAM service account
continue-on-error: true
run: |
aws cloudformation delete-stack --stack-name eksctl-prefect-addon-iamserviceaccount-kube-system-aws-node
aws cloudformation wait stack-delete-complete --stack-name eksctl-prefect-addon-iamserviceaccount-kube-system-aws-node
- name: Delete EKS agent service
continue-on-error: true
run: |
aws cloudformation delete-stack --stack-name eksctl-prefect-cluster
aws cloudformation wait stack-delete-complete --stack-name eksctl-prefect-cluster
- name: All AWS resources deleted
run: echo 'All AWS resources deleted! :rocket:' >> $GITHUB_STEP_SUMMARY