-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.56 KB
/
terraform-ci.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
67
68
---
name: Terraform CI
on:
pull_request:
branches:
- main
jobs:
formatting:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Check Terraform code is formatted
uses: docker://hashicorp/terraform:latest
with:
entrypoint: terraform
args: fmt -check -diff -recursive
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run Terraform init
uses: docker://hashicorp/terraform:latest
with:
entrypoint: terraform
args: init
- name: Run Terraform validate
uses: docker://hashicorp/terraform:latest
with:
entrypoint: terraform
args: validate
tflint:
name: TFLint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
name: Checkout source code
- uses: actions/cache@v4
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint
- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}
- name: Run TFLint
run: tflint -f compact