Question 310
A Terraform associate evaluates: A team wants resource creation order based on actual attribute relationships rather than HCL line order. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The observed situation is: A team wants resource creation order based on actual attribute relationships rather than HCL line order. The acceptance evidence is: The plan shows dependent resources using the produced attribute and schedules operations accordingly. It verifies the corrective approach (Reference a managed resource attribute directly in another resource argument so Terraform creates the appropriate dependency graph.) and controls the risk: Hardcoding an anticipated ID bypasses Terraform's graph and can reference a stale or nonexistent object. Checking an unrelated Terraform setting would not prove the stated requirement was met.
The case says: A team wants resource creation order based on actual attribute relationships rather than HCL line order. The directly relevant Terraform response is: Reference a managed resource attribute directly in another resource argument so Terraform creates the appropriate dependency graph. This addresses the related failure mode: Hardcoding an anticipated ID bypasses Terraform's graph and can reference a stale or nonexistent object. Validate the result by checking: The plan shows dependent resources using the produced attribute and schedules operations accordingly. The selection matches this objective, rather than a different Terraform administration task.
Incorrect Answers
Expose a child module's needed value as an output and reference it from the root through module.NAME.OUTPUT_NAME. This belongs to Cross-module output references (official objective 4b). Its separate risk is that trying to reach directly into a child module's private resource address bypasses the module interface. The question instead tests Implicit dependency through attribute reference; that other safeguard alone does not verify it.
Removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. This is relevant to count versus for_each stable addressing (official objective 4e). Its distinct failure risk is that removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. The present question tests Implicit dependency through attribute reference, which this measure alone does not establish.
terraform console evaluates the expression to the expected value for representative inputs. This does not provide the required Implicit dependency through attribute reference action-and-evidence pair.