-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (32 loc) · 1.11 KB
/
iac_deprovisioning.yaml
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
name: Deprovisioning of the AWS infraestructure
# Será executada as atividade abaixo de forma manual
on:
workflow_dispatch:
jobs:
provisioning:
runs-on: ubuntu-latest
defaults:
run:
working-directory: cloud_infra/terraform
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure Public SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa.pub
- name: Configure AWS credentials
run: |
mkdir -p ~/.aws
echo '[default]' > ~/.aws/credentials
echo 'aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }}' >> ~/.aws/credentials
echo 'aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}' >> ~/.aws/credentials
chmod 600 ~/.aws/credentials
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7.5"
- name: Terraform initialization (e.g., download provider plugins)
run: terraform init
- name: Remove infraestructure on AWS
run: terraform destroy -auto-approve