Question 240
A configuration review identifies the need to expose specific child values to its parent with an output block. Which mechanism most directly meets this particular need?
Explanation
Correct Answer
The task is to expose specific child values to its parent with an output block; Child module output scope directly supports that requirement: The parent can use module.child.output_name only when the child explicitly declares that output. Its relevant boundary is: Internal child locals and resource attributes remain encapsulated by default.
Incorrect Answers
Child module input variable is designed to pass a caller-defined value into a reusable child module, whereas this task is to expose specific child values to its parent with an output block: The child declares a variable and the parent's module block assigns a value to that argument. Against Child module output scope, its limitation is: An input declared in the child is not implicitly available as var.name in the parent.
Provider configuration scope is designed to keep provider instances configured in the root and pass them to child modules, whereas this task is to expose specific child values to its parent with an output block: A root module can explicitly map provider configurations into child module calls. Against Child module output scope, its limitation is: An aliased provider is not automatically inherited as a child alias.
Module outputs with repeated instances is designed to read values from every instance created by a counted or keyed module call, whereas this task is to expose specific child values to its parent with an output block: Counted module outputs use numeric indices; for_each module outputs use instance keys. Against Child module output scope, its limitation is: A repeated module call is not the same value shape as a single module output object.
Module input defaults is designed to make some child module arguments optional for callers, whereas this task is to expose specific child values to its parent with an output block: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. Against Child module output scope, its limitation is: A default does not override an explicitly passed module argument.