Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

5.2.2. Module Outputs and Composition

💡 First Principle: A module's outputs are the only values the caller can use, so composing modules means feeding one module's output into another's input — building larger systems by wiring small, well-defined contracts together.

A child module exposes results through output blocks; the caller reads them as module.<name>.<output>. Composition is the practice of connecting modules this way — for example, passing a network module's subnet_ids output into a compute module's subnet_ids input:

This keeps each module focused and lets you assemble infrastructure from reusable parts. The root module orchestrates by passing outputs as inputs, and the dependency between modules is implicit (just like resource references) because module.compute references module.network.subnet_ids.

⚠️ Exam Trap: You can only reference a child module's declared outputs — not its internal resources. module.network.aws_subnet.app.id is invalid; the network module must expose subnet_ids (or similar) as an output first. This boundary is tested.

Reflection Question: How does passing one module's output into another's input create the correct ordering between the two modules, without any depends_on?

Alvin Varughese
Written byAlvin Varughese
Founder18 professional certifications