-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (48 loc) · 1.81 KB
/
terraform-lint.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
# Run terraform fmt on all terraform files found in the infrastructure/terraform
# folder.
on:
push:
paths:
- "infrastructure/**.tf"
- "infrastructure/**.tfvars"
- ".github/workflows/terraform-*.yaml"
name: Terraform Lint
jobs:
terraform_format:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
# Run terraform fmt as rudimentary linting
- uses: hashicorp/[email protected]
- run: terraform init
- name: Terraform fmt
id: fmt
run: terraform fmt -recursive -check -diff -no-color infrastructure/terraform
continue-on-error: false
- name: Terraform Validate
run: terraform validate -no-color
- uses: terraform-linters/setup-tflint@v2
name: Setup TFLint
- name: Init TFLint
run: tflint --init
- name: Show version
run: tflint --version
- name: Run TFLint
env:
TFLINT_LOG: error
run: |
tflint --module --no-color --var='environment_name=dplplatlint' infrastructure/terraform/modules/dpl-platform-environment/ && \
tflint --module --no-color --var='environment_name=dplplatlint' infrastructure/terraform/modules/dpl-platform-env-repos/
# More complex example
tflint-reviewdog:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: tflint
uses: reviewdog/action-tflint@master
with:
github_token: ${{ secrets.github_token }}
working_directory: "infrastructure/terraform/modules/dpl-platform-environment" # Optional. Change working directory
filter_mode: "nofilter" # Optional. Check all files, not just the diff
tflint_rulesets: "azurerm" # Optional. Extra official rulesets to install
flags: "--module" # Optional. Add custom tflint flags