Skip to content

false negative for variables used only in their own validation block #94

@tpdownes

Description

@tpdownes

Suppose one has a root module with only the following block defined. Execute tflint --only=terraform_unused_declarations --chdir=. will result in exit code 0 and no warnings printed to the screen. Removing the validation block will generate the warnings. It's my belief that this represents a false negative as the validation block is internal to the input variable declaration and should not contribute to being "used".

variable "foo" {
  description = "bar"
  type        = bool
  default     = false

  validation {
    condition = var.foo
    error_message = "You gotta set me to true"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions