generated from geekcell/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (108 loc) · 2.64 KB
/
linter.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
################
## Run linter ##
################
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
name: Lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
##########################
# Prevent duplicate jobs #
##########################
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
###############
# Run the job #
###############
jobs:
##########
# TF fmt #
##########
tf-fmt:
name: FMT
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0
#####################
# Run Terraform fmt #
#####################
- name: Terraform fmt
uses: dflook/terraform-fmt-check@v1.29.1
##########
# TFLint #
##########
tf-lint:
name: TFLint
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0
#################
# Cache plugins #
#################
- name: Cache plugin dir
uses: actions/cache@v3.0.11
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
################
# Setup TFLint #
################
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v2
with:
tflint_version: v0.42.2
###############
# Init TFLint #
###############
- name: Init TFLint
run: tflint --init
##############
# Run TFLint #
##############
- name: Run TFLint
run: tflint -f compact
###########
# TF docs #
###########
tf-docs:
name: Docs
if: ${{ github.event_name == 'pull_request' }}
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/checkout@v3.1.0
with:
ref: ${{ github.event.pull_request.head.ref }}
####################
# Update README.md #
####################
- name: Terraform docs
uses: terraform-docs/gh-actions@v1.0.0
with:
ref: ${{ github.event.pull_request.head.ref }}
config-file: .terraform-docs.yml
git-push: true