Question 300
A Terraform associate evaluates: A service requires the latest approved image ID during its infrastructure plan. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The observed situation is: A service requires the latest approved image ID during its infrastructure plan. The acceptance evidence is: The lookup selects the intended existing object and downstream managed resources reference its identifier. It verifies the corrective approach (Use a provider data source that matches a unique existing remote object and feed its returned attributes into managed resource arguments.) and controls the risk: An ambiguous or missing data-source match can fail planning or target the wrong existing resource. Checking an unrelated Terraform setting would not prove the stated requirement was met.
The case says: A service requires the latest approved image ID during its infrastructure plan. The directly relevant Terraform response is: Use a provider data source that matches a unique existing remote object and feed its returned attributes into managed resource arguments. This addresses the related failure mode: An ambiguous or missing data-source match can fail planning or target the wrong existing resource. Validate the result by checking: The lookup selects the intended existing object and downstream managed resources reference its identifier. The selection matches this objective, rather than a different Terraform administration task.
Incorrect Answers
Use a resource block to manage an object lifecycle and a data block to read information about an existing object without claiming its lifecycle. This belongs to Managed resources versus data sources (official objective 4a). Its separate risk is that a data source query alone will not create or delete the referenced infrastructure object. The question instead tests Read-only data source lookup; that other safeguard alone does not verify it.
A root-level consumer resolves a declared module output and no undeclared child address is referenced. This is relevant to Cross-module output references (official objective 4b). Its distinct failure risk is that trying to reach directly into a child module's private resource address bypasses the module interface. The present question tests Read-only data source lookup, which this measure alone does not establish.
Removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. This addresses count versus for_each stable addressing (official objective 4e). The separate hazard is that removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. It does not by itself satisfy the case-specific requirement for Read-only data source lookup.