Question 320
A Terraform associate evaluates: A code reviewer asks why a child module output block is necessary for a parent dependency. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The case says: A code reviewer asks why a child module output block is necessary for a parent dependency. The directly relevant Terraform response is: Expose a child module's needed value as an output and reference it from the root through module.NAME.OUTPUT_NAME. This addresses the related failure mode: Trying to reach directly into a child module's private resource address bypasses the module interface. Validate the result by checking: A root-level consumer resolves a declared module output and no undeclared child address is referenced. The selection matches this objective, rather than a different Terraform administration task.
The observed situation is: A code reviewer asks why a child module output block is necessary for a parent dependency. The acceptance evidence is: A root-level consumer resolves a declared module output and no undeclared child address is referenced. It verifies the corrective approach (Expose a child module's needed value as an output and reference it from the root through module.NAME.OUTPUT_NAME.) and controls the risk: Trying to reach directly into a child module's private resource address bypasses the module interface. Checking an unrelated Terraform setting would not prove the stated requirement was met.
Incorrect Answers
Using an ordinary resource argument can persist secrets in state, while unsupported write-only fields cannot be assumed to exist. This belongs to Provider write-only arguments and Vault integration (official objective 4h). Its separate risk is that using an ordinary resource argument can persist secrets in state, while unsupported write-only fields cannot be assumed to exist. The question instead tests Cross-module output references; that other safeguard alone does not verify it.
Reference a managed resource attribute directly in another resource argument so Terraform creates the appropriate dependency graph. This is relevant to Implicit dependency through attribute reference (official objective 4b). Its distinct failure risk is that hardcoding an anticipated ID bypasses Terraform's graph and can reference a stale or nonexistent object. The present question tests Cross-module output references, which this measure alone does not establish.
An authorized workflow can consume the output while casual CLI display is redacted and backend access remains restricted. This does not provide the required Cross-module output references action-and-evidence pair.