Duplicate variable declaration
esacteksab opened this issue · comments
Barry Morrison commented
Summary
I had a duplicate variable declared in variables.tf
, tflint
found nothing. But terraform validate
produces an error (a plan/apply also errors). The error is 'Duplicate variable declaration'. This feels like a bug, and feels like something tflint
should be able to detect and possibly address with --fix
though it is possible for duplicate variables to exist, but their description
, type
, default
, could be different, so it may be difficult to determine which one to delete.
Command
tflint
Terraform Configuration
"unhealthy_threshold" {
description = "The number of consecutive health check failures required before considering the target unhealthy. For Network Load Balancers, this value must be the same as the healthy_threshold. Defaults to 3."
type = string
default = 3
}
variable "unhealthy_threshold" {
description = "The number of consecutive health check failures required before considering the target unhealthy. For Network Load Balancers, this value must be the same as the healthy_threshold. Defaults to 3."
type = string
default = 3
}
TFLint Configuration
Not using one.
Output
No error printed. Terraform emits the following message
terraform validate
╷
│ Error: Duplicate variable declaration
│
│ on variables.tf line 242:
│ 242: variable "unhealthy_threshold" {
│
│ A variable named "unhealthy_threshold" was already declared at variables.tf:236,1-31. Variable names must be unique within a module.
### TFLint Version
0.50.2
### Terraform Version
1.6.5
### Operating System
- [ ] Linux
- [X] macOS
- [ ] Windows