Question 600
At Silverlake Data Platforms, an authorized infrastructure engineering team manages a Terraform 1.12 and HCP Terraform environment. The team encounters the following situation: a team uses a direct map key index for an optional environment setting and fails on absent keys. Choose the technically best Terraform Associate 004 practice response to this particular infrastructure case. Which operational control addresses the risk long term?
Explanation
Correct Answer
Review all collection lookup assumptions in reusable modules. This control addresses function lookup with fallback because direct indexing fails for missing map keys while lookup can provide a documented fallback. The original implementation remedy remains: Use lookup with an intentional default or validate required keys explicitly.
Incorrect Answers
This safeguard is for the dependency described by: For expressions transform collections into new values without external preprocessing. The continuing risk here is determined by: Direct indexing fails for missing map keys while lookup can provide a documented fallback. The targeted safeguard is “Review all collection lookup assumptions in reusable modules”.
“Define shared-resource lookup contracts and key ownership” addresses a different recurring failure: Existing shared encryption infrastructure should not be duplicated by consumers needing only its identifier. For the condition in this question, maintain “Review all collection lookup assumptions in reusable modules” because direct indexing fails for missing map keys while lookup can provide a documented fallback.
This safeguard is for the dependency described by: State tracks configuration addresses and a rename needs a migration mapping to preserve ownership. The continuing risk here is determined by: Direct indexing fails for missing map keys while lookup can provide a documented fallback. The targeted safeguard is “Review all collection lookup assumptions in reusable modules”.