canonical-terraform-declarations
Keep variable and output declarations in their owning module canonical interface files.
Why
A module's inputs and exports form its interface. Canonical files expose that interface without introducing folders Terraform does not load.
Fix
Consolidate declarations into variables.tf or outputs.tf in the same module directory; use variables.tf.json or outputs.tf.json for JSON. Keep implementation and deployment entrypoints in place. Review comments, override files and duplicate declarations before moving blocks.
Examples
variable "region" { type = string }resource "terraform_data" "this" { input = var.region }variable "project" { type = string }variable "region" { type = string }Autofix output
resource "terraform_data" "this" { input = var.region }variable "project" { type = string }
variable "region" { type = string }{ "output": { "endpoint": { "value": "${var.endpoint}" } } }{ "output": { "endpoint": { "value": "${var.endpoint}" } } }