-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (45 loc) · 1.37 KB
/
terraform.yml
File metadata and controls
53 lines (45 loc) · 1.37 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: 'Validate Terraform'
on:
push:
branches:
- main
pull_request:
jobs:
terraform:
name: 'Validate Terraform'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.8 # Required as of Apr 15 2021 because of breaking changes in tf 0.15
- name: Terraform fmt
id: fmt
run: terraform fmt -recursive
continue-on-error: true
- name: Terraform Init
id: init
run: |
terraform init -backend=false
- name: Terraform Validate
id: validate
env:
# Not used, but necessary as some sub-modules reference it.
AWS_REGION: 'us-east-1'
run: |
terraform validate -no-color
- uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖${{ steps.validate.outputs.stdout }}
`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})