Question 410
A Terraform associate evaluates: A module should reject an unsupported environment tier before creating resources. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The observed situation is: A module should reject an unsupported environment tier before creating resources. The acceptance evidence is: An invalid test input fails with the intended error while an approved value passes validation. It verifies the corrective approach (Use a variable validation block with a clear condition and error message to reject invalid caller inputs before changes are planned.) and controls the risk: Malformed input values can drive unsupported sizes or unsafe configuration even when their basic types are valid. Checking an unrelated Terraform setting would not prove the stated requirement was met.
The case says: A module should reject an unsupported environment tier before creating resources. The directly relevant Terraform response is: Use a variable validation block with a clear condition and error message to reject invalid caller inputs before changes are planned. This addresses the related failure mode: Malformed input values can drive unsupported sizes or unsafe configuration even when their basic types are valid. Validate the result by checking: An invalid test input fails with the intended error while an approved value passes validation. The selection matches this objective, rather than a different Terraform administration task.
Incorrect Answers
A supported write-only argument updates the target without storing the supplied secret in state or plan. This belongs to Provider write-only arguments and Vault integration (official objective 4h). Its separate risk is that using an ordinary resource argument can persist secrets in state, while unsupported write-only fields cannot be assumed to exist. The question instead tests Input variable validation rules; that other safeguard alone does not verify it.
Use lifecycle precondition or postcondition for enforceable resource assertions and check blocks for nonblocking health diagnostics when appropriate. This is relevant to Preconditions postconditions and checks (official objective 4g). Its distinct failure risk is that confusing advisory checks with hard validation gates can let an unsafe value pass despite a warning. The present question tests Input variable validation rules, which this measure alone does not establish.
Manually duplicating derived labels and tags across resources invites inconsistency and errors. This addresses Terraform expressions and built-in functions (official objective 4e). The separate hazard is that manually duplicating derived labels and tags across resources invites inconsistency and errors. It does not by itself satisfy the case-specific requirement for Input variable validation rules.