Question 330
A Terraform associate evaluates: A module should reject a string when the declared input type requires a number. Select TWO complementary responses: the appropriate action AND direct evidence it worked.
Explanation
Correct Answers
The case says: A module should reject a string when the declared input type requires a number. The directly relevant Terraform response is: Declare typed input variables and supply different values through approved tfvars or other documented input mechanisms rather than editing module internals. This addresses the related failure mode: Hardcoded environment values in shared configuration create accidental cross-environment changes. Validate the result by checking: A plan shows the intended input values for the selected environment and variable validation accepts them. The selection matches this objective, rather than a different Terraform administration task.
The observed situation is: A module should reject a string when the declared input type requires a number. The acceptance evidence is: A plan shows the intended input values for the selected environment and variable validation accepts them. It verifies the corrective approach (Declare typed input variables and supply different values through approved tfvars or other documented input mechanisms rather than editing module internals.) and controls the risk: Hardcoded environment values in shared configuration create accidental cross-environment changes. Checking an unrelated Terraform setting would not prove the stated requirement was met.
Incorrect Answers
Declare outputs for intended consumer values and mark sensitive outputs appropriately while separately protecting any state that may contain them. This belongs to Outputs and sensitive display control (official objective 4c). Its separate risk is that a sensitive output designation hides normal CLI disclosure but does not guarantee the underlying state contains no secret. The question instead tests Input variables and default or CLI overrides; that other safeguard alone does not verify it.
Removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. This is relevant to count versus for_each stable addressing (official objective 4e). Its distinct failure risk is that removing a middle entry from a count-indexed collection can shift addresses and provoke unintended replacements. The present question tests Input variables and default or CLI overrides, which this measure alone does not establish.
The resource graph includes the required ordering without invented dependencies between unrelated resources. This addresses Explicit depends_on for hidden dependencies (official objective 4f). The separate hazard is that terraform may not infer relationships that have no data reference, but excessive explicit dependencies can make plans unnecessarily conservative. It does not by itself satisfy the case-specific requirement for Input variables and default or CLI overrides.