You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
This discussion was converted from issue #1975 on February 06, 2024 20:03.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
I had a duplicate variable declared in
variables.tf
,tflint
found nothing. Butterraform validate
produces an error (a plan/apply also errors). The error is 'Duplicate variable declaration'. This feels like a bug, and feels like somethingtflint
should be able to detect and possibly address with--fix
though it is possible for duplicate variables to exist, but theirdescription
,type
,default
, could be different, so it may be difficult to determine which one to delete.Command
tflint
Terraform Configuration
TFLint Configuration
Not using one.
Output
Beta Was this translation helpful? Give feedback.
All reactions