From the official Terraform Type Constraints Documentation:
The object({ name = string, age = number }) type expects:
name to be aquoted string, e.g. " John "
age to be anumber, e.g. 52
Option Bsatisfies both:
{
name = " John " #✅Valid string
age = 52 #✅Valid number
}
Let ' s analyze the incorrect ones:
❌Option A: " fifty two " is not a valid number.
❌Option C: John is unquoted (invalid string), and " fifty two " is not a number.
❌Option D: name = John is not quoted, making it an invalid string in HCL.
Terraform is strict about type and formatting. Stringsmust be quoted, and numbersmust be numeric literals.