Closed levinotik closed 2 years ago
This is not an issue for modules. See the following documentation for details. https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.1.0/docs/rules/terraform_required_version.md
I'm sorry, I meant to paste the following error related to terraform_module_version
, not terraform_required_version
:
Warning: module "db_security_group" should specify a version (terraform_module_version)
on main.tf line 29:
29: module "db_security_group" {
where this points to a module I have defined (not from a registry):
module "security_group" {
source = "./security_group"
environment = var.environment
vpc = module.vpc.vpc
depends_on = [
module.vpc
]
}
Hmm, I cannot reproduce it. Do you have a minimal reproducible code?
% cat .tflint.hcl
config {
disabled_by_default = true
}
rule "terraform_module_version" {
enabled = true
}
% cat main.tf
module "security_group" {
source = "./security_group"
environment = var.environment
vpc = module.vpc.vpc
depends_on = [
module.vpc
]
}
module "latest" {
source = "terraform-aws-modules/vpc/aws"
}
% tflint
1 issue(s) found:
Warning: module "latest" should specify a version (terraform_module_version)
on main.tf line 10:
10: module "latest" {
Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.1.1/docs/rules/terraform_module_version.md
% tflint -v
TFLint version 0.40.1
+ ruleset.terraform (0.1.1-bundled)
Wow, you know what...this was me just having a total brain fart and misreading the modules that tflint was complaining about. The modules in question are, in fact, modules from the registry and so the warnings are legitimate and helpful! So sorry for the confusion! Closing issue.
I am using tflint via pre-commit-terraform and running into an issue with some of the rules. I'm not sure if this is due to the way I'm running tflint or if this is truly a bug.
The issue I'm running into is warnings about missing
required_version
for modules that are defined locally, not from any registry. According to the terraform docs:Yet, for each of my own local modules, tflint produces the following error:
For example, each of the following produces this warning:
I may very well be missing something basic. Please let me know if I am. Thanks!