I'm facing a strange problem. I have countless examples in my repository which do not contain any provider file or config. To avoid the errors regarding this, I would love to disable the related tflint rules terraform_required_version
and terraform_required_providers
.
I tried the config below running tflint --config=.tflint.hcl --recursive
, but tflint still reports these types of errors:
32 issue(s) found:
Warning: terraform "required_version" attribute is required (terraform_required_version)
on line 0:
(source code not available)
Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_required_version.md
....
Warning: Missing version constraint for provider "aws" in `required_providers` (terraform_required_providers)
on modules/rds/password_secrets_manager/main.tf line 26:
26: resource "aws_secretsmanager_secret_version" "secret_version" {
Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_required_providers.md
What do I do wrong?
I have the following .tflint.hcl
config:
config {
force = true
module = true
disabled_by_default = false
}
plugin "terraform" {
enabled = true
version = "0.5.0"
source = "github.com/terraform-linters/tflint-ruleset-terraform"
}
plugin "aws" {
enabled = true
version = "0.28.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}
rule "terraform_required_version" {
enabled = false
}
rule "terraform_required_providers" {
enabled = false
}
I had the same issue and found out that if you use the
--recursive
flag, it expects the.tflint.hcl
file to be present in every directory in the file tree. I will write a Python script to enter every folder, copy the file in the directory, use linting, and delete it again. If there is a better I am all ears.Something like