-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (42 loc) · 1.19 KB
/
terraform-apply.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
name: "Network Terraform Apply"
on:
## Trigger the workflow manually
workflow_dispatch:
env:
TF_WORKSPACE: "default"
CONFIG_DIRECTORY: "./terraform"
jobs:
terraform:
name: "Network Terraform Plan & Apply"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.CONFIG_DIRECTORY }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Assume AWS Credentials
id: assume
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: ${{ github.actor }}
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
- uses: hashicorp/setup-terraform@v3
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: terraform plan -no-color -out=tf.plan
- name: Terraform Apply
run: terraform apply -auto-approve tf.plan