Measure the size and complexity of variable definitions across a Terraform configuration.
Formula: total_vars = variables + locals + outputs. The complexity score weights required (no-default) variables highest since they represent mandatory caller burden, followed by local values (internal derived logic that's harder to trace), then optional variables and outputs. A module with many required variables and heavy local computation is harder to consume and maintain than one with sensible defaults and a thin interface.
complexity_score = required_vars × 3 + optional_vars × 1 + locals × 1.5 + outputs × 1
Every required variable is something every caller of the module must understand and supply correctly — it's an ongoing tax on every consumer, whereas complex locals are a one-time authoring cost paid by the module maintainer.
Well-designed reusable modules often keep required variables under 5-8, pushing everything else to sensible defaults — a module needing 20+ required inputs is a signal it may be doing too much and could be split.
Use `grep -c` for `^variable`, `^locals` blocks (note locals blocks can contain multiple values), and `^output` across your `.tf` files, or `terraform-docs` which generates this inventory automatically.
Not inherently — modules meant to be composed by other modules often need many outputs to expose resource attributes; it's more of a complexity signal when combined with high required-variable counts on the same module.