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.
- Other modules and stacks consume them (
module.vpc.vpc_id). - Outputs are the only way to reach values inside a child module.
- 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.
More on Modules and Code Structure
When do you turn a block of resources into a module, and when do you leave it alone?BeginnerHow do you consume a community module like `terraform-aws-modules/vpc/aws` responsibly?BeginnerAn ECS service module needs the VPC and subnets created by a network module. How do you wire them together?IntermediateHow would you lay out a repo that deploys the same stack to dev, stage and prod?IntermediateHow do you release a shared module so consumers can upgrade at their own pace?IntermediateA module needs to deploy to a second region. Why does putting a provider block inside the module cause trouble?Advanced