Skip to content

Commit

Permalink
Add dedicated TFLint config file for test modules
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Schwarz <[email protected]>
  • Loading branch information
rswrz committed Sep 20, 2024
1 parent 29f59a9 commit 20d3fa5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
hooks:
- id: terraform_fmt
- id: terraform_tflint
exclude: ^examples/
exclude: ^(examples|tests)/
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
- --hook-config=--delegate-chdir
Expand All @@ -26,6 +26,15 @@ repos:
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.examples.hcl
- --hook-config=--delegate-chdir

- id: terraform_tflint
alias: terraform_tflint_tests
name: Terraform validate tests with tflint
files: ^tests/
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.tests.hcl
- --hook-config=--delegate-chdir

- id: terraform_trivy
exclude: ^(examples|tests)/
args:
Expand Down
8 changes: 8 additions & 0 deletions .tflint.examples.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ plugin "azurerm" {
version = "0.27.0"
}

rule "terraform_documented_variables" {
enabled = false
}

rule "terraform_documented_outputs" {
enabled = false
}

rule "terraform_module_version" {
enabled = false
}
Expand Down
27 changes: 27 additions & 0 deletions .tflint.tests.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
tflint {
required_version = "~> 0.50"
}

plugin "terraform" {
enabled = true

source = "github.com/terraform-linters/tflint-ruleset-terraform"
version = "0.9.1"

preset = "all"
}

plugin "azurerm" {
enabled = true

source = "github.com/terraform-linters/tflint-ruleset-azurerm"
version = "0.27.0"
}

rule "terraform_unused_required_providers" {
enabled = false
}

rule "terraform_standard_module_structure" {
enabled = false
}

0 comments on commit 20d3fa5

Please sign in to comment.