Skip to content

Commit

Permalink
PRSD-571: Adds tflint
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis-Softwire committed Dec 19, 2024
1 parent d64e3a1 commit 64c93ac
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check-and-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,35 @@ jobs:
working-directory: terraform/integration/backend
run: terraform validate

tflint:
name: tflint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.1

- name: Cache plugin directory for tflint
uses: actions/cache@v3
with:
path: ~/.tflint.d/plugins
key: ubuntu-latest-tflint-${{ hashFiles('.tflint.hcl') }}

- name: Set up tflint
uses: terraform-linters/setup-tflint@v4
with:
tflint_version: v0.54.0

- name: Init tflint
run: tflint --init

- name: Run tflint
run: tflint --recursive --config "$(pwd)/.tflint.hcl" --format=compact --color

tfsec:
name: tfsec
runs-on: ubuntu-latest
Expand Down
35 changes: 35 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugin "terraform" {
enabled = true
preset = "recommended"
}

rule "terraform_comment_syntax" {
enabled = true
}

rule "terraform_documented_outputs" {
enabled = true
}

rule "terraform_documented_variables" {
enabled = true
}

rule "terraform_naming_convention" {
enabled = true
format = "snake_case"
}

rule "terraform_unused_required_providers" {
enabled = true
}

config {
call_module_type = "all"
}

plugin "aws" {
enabled = true
version = "0.24.1"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

0 comments on commit 64c93ac

Please sign in to comment.