Question 420
A Terraform associate evaluates: An engineer asks when a lifecycle condition is preferable to a general diagnostic check. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The observed situation is: An engineer asks when a lifecycle condition is preferable to a general diagnostic check. The acceptance evidence is: A purposely violated precondition blocks the operation while an independent check reports its observed condition as designed. It verifies the corrective approach (Use lifecycle precondition or postcondition for enforceable resource assertions and check blocks for nonblocking health diagnostics when appropriate.) and controls the risk: Confusing advisory checks with hard validation gates can let an unsafe value pass despite a warning. Checking an unrelated Terraform setting would not prove the stated requirement was met.
The case says: An engineer asks when a lifecycle condition is preferable to a general diagnostic check. The directly relevant Terraform response is: Use lifecycle precondition or postcondition for enforceable resource assertions and check blocks for nonblocking health diagnostics when appropriate. This addresses the related failure mode: Confusing advisory checks with hard validation gates can let an unsafe value pass despite a warning. Validate the result by checking: A purposely violated precondition blocks the operation while an independent check reports its observed condition as designed. The selection matches this objective, rather than a different Terraform administration task.
Incorrect Answers
The resource graph includes the required ordering without invented dependencies between unrelated resources. This belongs to Explicit depends_on for hidden dependencies (official objective 4f). Its separate risk is that terraform may not infer relationships that have no data reference, but excessive explicit dependencies can make plans unnecessarily conservative. The question instead tests Preconditions postconditions and checks; that other safeguard alone does not verify it.
Use a variable validation block with a clear condition and error message to reject invalid caller inputs before changes are planned. This is relevant to Input variable validation rules (official objective 4g). Its distinct failure risk is that malformed input values can drive unsupported sizes or unsafe configuration even when their basic types are valid. The present question tests Preconditions postconditions and checks, which this measure alone does not establish.
Trying to reach directly into a child module's private resource address bypasses the module interface. That is the exact risk associated with Cross-module output references (official objective 4b), not the required Preconditions postconditions and checks outcome.