-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (63 loc) · 2.02 KB
/
linter.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: "Terraform Checks"
defaults:
run:
shell: bash
on:
pull_request:
jobs:
# Performs linting and format checks and suggests fixes on PR
terraform-linter:
name: Terraform Linter
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
terraform_version: [1.5.6, 1.10.1] # Actual and latest versions used
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: true
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "${{ matrix.terraform_version }}"
- name: Terraform init
run: terraform init
- name: Tflint Report Output
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tflint_version: "v0.49.0" # Version set due to this https://github.com/reviewdog/action-tflint/issues/83
reporter: github-pr-review
fail_on_error: "true"
filter_mode: "added"
flags: "--module" # This option should work until tflint v0.5.1.
# Performs linting and format checks and suggests fixes on PR
terraform-formatter:
name: Terraform Formatter
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
terraform_version: [1.5.6, 1.10.1] # Actual and latest versions used
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: true
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "${{ matrix.terraform_version }}"
- name: Terraform init
run: terraform init
# This step applies format suggestions locally which would be used by a suggester
- name: Terraform Format suggestions
run: terraform fmt
- uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tool_name: "terraform"
fail_on_error: "true"
filter_mode: "added"