Question 570
At Riverstone Retail Infrastructure, an authorized infrastructure engineering team manages a Terraform 1.12 and HCP Terraform environment. The team encounters the following situation: a JSON import supplies numeric port values in a list of strings and a consumer assumes values remain numeric. Choose the technically best Terraform Associate 004 practice response to this particular infrastructure case. What mechanism explains why the original approach fails?
Explanation
Correct Answer
Terraform may convert compatible primitive values but a typed module should define the intended representation. That mechanism distinguishes type conversion list of strings in the Riverstone Retail Infrastructure case. The corresponding appropriate correction is: Use an explicit collection type and convert or validate port values appropriately. The measurable acceptance test is: The port collection is validated and rendered as accepted numeric arguments.
Incorrect Answers
This alternative is valid when complex object type definitions can include optional attributes rather than requiring every field. The facts here establish a different controlling reason: Terraform may convert compatible primitive values but a typed module should define the intended representation.
“For expressions transform collections into new values without external preprocessing” reflects the mechanism: For expressions transform collections into new values without external preprocessing. The actual reported symptoms are better explained by: Terraform may convert compatible primitive values but a typed module should define the intended representation.
The offered principle describes: Destroying managed infrastructure can delete underlying data depending on resource behavior and provider settings. The situation in this question instead depends on: Terraform may convert compatible primitive values but a typed module should define the intended representation. These are different technical conditions.