-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (50 loc) · 1.4 KB
/
main.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
name: 'Terraform GitHub Actions'
on:
workflow_dispatch:
push:
branches:
- main
env:
tf_version: 'latest'
tf_working_dir: '.'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
terraform:
environment: main
name: 'Terraform'
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: write
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ap-southeast-2
role-to-assume: arn:aws:iam::143841941773:role/github
role-session-name: Terraform
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.1.5
- name: 'Checkout'
uses: actions/checkout@master
- name: Terraform fmt
id: fmt
run: terraform fmt
continue-on-error: true
- uses: EndBug/add-and-commit@v7
with:
message: Terraform fmt [skip ci]
committer_name: GitHub Actions
committer_email: [email protected]
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Apply
id: apply
run: terraform apply -input=false -auto-approve
continue-on-error: true