-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.32 KB
/
destroy.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Destroy Environment
on:
workflow_dispatch:
inputs:
stage:
type: choice
description: Environment to destroy
options:
- dev
- qa
- prod
message:
required: true
env:
aws_account_id: ${{ vars.AWS_ACCOUNT_ID }}
aws_region: ${{ vars.AWS_REGION }}
aws_role: ${{ vars.AWS_ROLE }}
permissions:
id-token: write
contents: read
jobs:
destroy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.aws_region }}
role-to-assume: arn:aws:iam::${{ env.aws_account_id }}:role/${{ env.aws_role }}
role-session-name: GitHubActions
- name: Init
shell: bash
run: |
cd tf
terraform init
- name: Select Workspace
shell: bash
run: |
cd tf
terraform workspace select -or-create ${{ inputs.stage }}
terraform init
- name: Action
shell: bash
id: action
run: |
cd tf
terraform destroy -auto-approve -var function-stage=${{ inputs.stage }} -var lambda-zip-path=this_file_doesnt_exist.zip