-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (37 loc) · 1.05 KB
/
Copy pathdeploy_infraestructure.yml
File metadata and controls
39 lines (37 loc) · 1.05 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
name: Terraform deployment
on:
push:
branches: [main]
paths:
- 'terraform/**'
pull_request:
branches: [main]
paths:
- 'terraform/**'
jobs:
config:
name: 'Create infraestructure (Terraform)'
runs-on: ubuntu-latest
env:
TF_VAR_aws_region: us-east-1
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_ACCESS_SECRET}}
- name: Init Terraform
uses: hashicorp/setup-terraform@v2
- name: Terraform init
run: terraform init
working-directory: ./terraform
- name: Terraform plan
run: terraform plan
working-directory: ./terraform
- name: Terraform apply
if: github.event_name == 'push' && github.ref_name == 'main'
run: terraform apply -auto-approve
working-directory: ./terraform