-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (60 loc) · 1.74 KB
/
terraform.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Terraform Deploy
on:
push:
branches:
- master
paths:
- 'infra/**'
- .github/workflows/terraform.yaml
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
plan-and-approve:
runs-on: ubuntu-latest
env:
AWS_REGION: sa-east-1
steps:
- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ env.AWS_REGION }}
- name: install terraform
uses: hashicorp/setup-terraform@v2
- name: checkout repository
uses: actions/checkout@v3
with:
submodules: 'true'
- name: terraform init
run: terraform init
working-directory: infra
- name: terraform plan
run: terraform plan
working-directory: infra
execute-plan:
runs-on: ubuntu-latest
needs: plan-and-approve
environment: production # This is required for the approval step
env:
AWS_REGION: sa-east-1
steps:
- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: ${{ env.AWS_REGION }}
- name: install terraform
uses: hashicorp/setup-terraform@v2
- name: checkout repository
uses: actions/checkout@v3
with:
submodules: 'true'
- name: terraform init
run: terraform init
working-directory: infra
- name: terraform apply
run: terraform apply -auto-approve
working-directory: infra