Skip to content
Sarj Code Standards

no-unused-module-inputs

Find forwarded Terraform inputs without a reachable consumer.

Why

A variable referenced only by unused locals or discarded module arguments still passes a textual unused-declaration check. Its interface requires callers to maintain configuration that reaches no resource, validation, public export or external module.

Fix

Review the declaration, every caller and their tfvars together. Remove the dead plumbing only after preserving required inputs, type conversion, validation, source-reading functions and external contracts. Do not replace operational controls with constants.

Examples

Before — flagged A local reference does not establish effective consumption
.sarj-standards.toml
[iac.no-unused-module-outputs]
internal_modules = ["child"]
child/main.tf
locals { unused = var.region }
child/variables.tf
variable "region" { type = string }
main.tf
module "child" {
source = "./child"
region = "west"
}
After — preferred A resource argument consumes the forwarded value
.sarj-standards.toml
[iac.no-unused-module-outputs]
internal_modules = ["child"]
child/main.tf
resource "example" "service" { region = var.region }
child/variables.tf
variable "region" { type = string }
main.tf
module "child" {
source = "./child"
region = "west"
}