Reproduced on 23 October 2026 with Terraform 1.14.0. terraform validate printed Error: Reference to undeclared input variable with the file and line, then either Did you mean "region"? when a declared name was close, or This variable can be declared with a variable "env" {} block.
Five different mistakes produced the same error: a misspelled name; a child module using a variable that only the root module declares; a value present only in terraform.tfvars; a locals value read as var.NAME; and a variable block saved in a subdirectory. Terraform reads only the .tf and .tf.json files in the module's own directory, and the HashiCorp docs treat nested directories as separate modules.
With the value only in terraform.tfvars, terraform plan also printed Warning: Value for undeclared variable before the error. That warning names the missing declaration.