Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

A child module's `variable "tags" { type = map(string) }` rejects your input: `Invalid value for input variable ... element "cost_center": string required`.

BeginnerTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → A value in the map isn't a string (number, bool, null, nested object).

Diagnose → Look at the element named in the error.

Fix → Convert: cost_center = tostring(var.cost_center), or remove nulls with { for k, v in var.tags : k => v if v != null }.

Prevent → Normalize tags in one locals block before passing to modules.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces