Question 400
A Terraform associate evaluates: A production review asks whether the planned replacement will create the new object before deleting the old. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The observed situation is: A production review asks whether the planned replacement will create the new object before deleting the old. The acceptance evidence is: The replacement plan shows create-before-destroy ordering and a test confirms provider constraints permit both instances. It verifies the corrective approach (Use lifecycle create_before_destroy for supported replacements requiring new capacity before old removal, while checking name uniqueness and provider constraints.) and controls the risk: A replacement may fail if a globally unique name prevents a second object from existing simultaneously. Checking an unrelated Terraform setting would not prove the stated requirement was met.
The case says: A production review asks whether the planned replacement will create the new object before deleting the old. The directly relevant Terraform response is: Use lifecycle create_before_destroy for supported replacements requiring new capacity before old removal, while checking name uniqueness and provider constraints. This addresses the related failure mode: A replacement may fail if a globally unique name prevents a second object from existing simultaneously. Validate the result by checking: The replacement plan shows create-before-destroy ordering and a test confirms provider constraints permit both instances. The selection matches this objective, rather than a different Terraform administration task.
Incorrect Answers
A data source query alone will not create or delete the referenced infrastructure object. 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 Lifecycle create_before_destroy; that other safeguard alone does not verify it.
A plan shows the intended input values for the selected environment and variable validation accepts them. This is relevant to Input variables and default or CLI overrides (official objective 4c). Its distinct failure risk is that hardcoded environment values in shared configuration create accidental cross-environment changes. The present question tests Lifecycle create_before_destroy, which this measure alone does not establish.
Use depends_on only when a real ordering requirement is not represented by an attribute reference, after checking implicit dependencies first. That addresses Explicit depends_on for hidden dependencies (official objective 4f), specifically the hazard that terraform may not infer relationships that have no data reference, but excessive explicit dependencies can make plans unnecessarily conservative. Here the necessary action or evidence is the paired action The replacement plan shows create-before-destroy ordering and a test confirms provider constraints permit both instances and separate validation Use lifecycle create_before_destroy for supported replacements requiring new capacity before old removal, while checking name uniqueness and provider constraints, not that separate control.