Question 290
A Terraform associate evaluates: A developer references a provider data source but cannot see any create action in the plan. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The case says: A developer references a provider data source but cannot see any create action in the plan. The directly relevant Terraform response is: 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 addresses the related failure mode: A data source query alone will not create or delete the referenced infrastructure object. Validate the result by checking: The plan creates only declared managed resources while existing data-source objects are read and remain unmanaged. The selection matches this objective, rather than a different Terraform administration task.
The observed situation is: A developer references a provider data source but cannot see any create action in the plan. The acceptance evidence is: The plan creates only declared managed resources while existing data-source objects are read and remain unmanaged. It verifies the corrective approach (Use a resource block to manage an object lifecycle and a data block to read information about an existing object without claiming its lifecycle.) and controls the risk: A data source query alone will not create or delete the referenced infrastructure object. Checking an unrelated Terraform setting would not prove the stated requirement was met.
Incorrect Answers
The plan adds or removes the intended keyed resource without renumbering unrelated instances. This belongs to count versus for_each stable addressing (official objective 4e). Its separate risk is that removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. The question instead tests Managed resources versus data sources; that other safeguard alone does not verify it.
Hardcoded environment values in shared configuration create accidental cross-environment changes. This addresses Input variables and default or CLI overrides (official objective 4c). The separate hazard is that hardcoded environment values in shared configuration create accidental cross-environment changes. It does not by itself satisfy the case-specific requirement for Managed resources versus data sources.
Use a provider data source that matches a unique existing remote object and feed its returned attributes into managed resource arguments. This does not provide the required Managed resources versus data sources action-and-evidence pair.