Interview Prep/Terraform/Modules and Code Structure

A new engineer asks why modules have `outputs.tf` full of IDs they never use.

BeginnerScenarioModules and Code Structure
Answer

Situation read → They see unused outputs as clutter.

What I'd do → Explain that outputs are the public interface of the module.

  1. Other modules and stacks consume them (module.vpc.vpc_id).
  2. Outputs are the only way to reach values inside a child module.
  3. Keep them: removing one is a breaking change for consumers.

Why → Child module internals are not accessible from the caller; outputs define what is supported.

Interview tip → Output IDs and ARNs of key resources, with descriptions.

All Terraform questions Roadmap: Terraform

More on Modules and Code Structure