Question 260
A Terraform associate evaluates: A cleanup job must confirm that its state backend belongs to the approved ephemeral environment. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The case says: A cleanup job must confirm that its state backend belongs to the approved ephemeral environment. The directly relevant Terraform response is: Verify active backend, workspace and state scope before destructive runs to avoid deleting unrelated managed environments. This addresses the related failure mode: Running destroy in the wrong selected workspace can remove live resources rather than the intended test stack. Validate the result by checking: The active workspace and plan match the decommission ticket and no production resources are selected. The selection matches this objective, rather than a different Terraform administration task.
The observed situation is: A cleanup job must confirm that its state backend belongs to the approved ephemeral environment. The acceptance evidence is: The active workspace and plan match the decommission ticket and no production resources are selected. It verifies the corrective approach (Verify active backend, workspace and state scope before destructive runs to avoid deleting unrelated managed environments.) and controls the risk: Running destroy in the wrong selected workspace can remove live resources rather than the intended test stack. Checking an unrelated Terraform setting would not prove the stated requirement was met.
Incorrect Answers
Use terraform plan -destroy to review intended deletions, then terraform destroy only when the infrastructure should be removed. This belongs to Destroy with visibility into consequences (official objective 3f). Its separate risk is that a destroy operation can remove every managed object in the active configuration and state, not just temporary resources. The question instead tests Destroy scope and workspace safety; that other safeguard alone does not verify it.
The apply log reports completion and a subsequent plan shows only any remaining deliberate differences. This is relevant to Apply reviewed changes (official objective 3e). Its distinct failure risk is that terraform apply mutates managed infrastructure; treating it as a read-only preview can cause outages. The present question tests Destroy scope and workspace safety, which this measure alone does not establish.
A consistently formatted file can still contain invalid references or unsupported provider attributes. This addresses Formatting Terraform HCL (official objective 3g). The separate hazard is that a consistently formatted file can still contain invalid references or unsupported provider attributes. It does not by itself satisfy the case-specific requirement for Destroy scope and workspace safety.