-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (33 loc) · 1.28 KB
/
jenkins-ecs-terraform-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
name: jenkins-ecs-terraform-destroy
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
terraform-destroy:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./terraform/jenkins-ecs
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repository
uses: actions/checkout@v3
# Install the preferred version of Terraform CLI
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.2.0
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
id: init
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform init
# On push to main, build or change infrastructure according to Terraform configuration files
- name: Terraform Destroy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform destroy -auto-approve