Complete the code to define an object type with an optional attribute.
variable "config" { type = object({ name = string age = number city = [1] # optional attribute }) }
The optional(string) marks the city attribute as optional in the object type.
Complete the code to assign a value to the optional attribute in a variable.
variable "config" { default = { name = "Alice" age = 30 city = [1] } }
Assigning a string value like "New York" to the optional city attribute is valid.
Fix the error in the object type definition by correctly marking the optional attribute.
variable "config" { type = object({ name = string age = number city = [1] }) }
The city attribute must be marked as optional(string) to avoid errors when it is not provided.
Fill both blanks to define an object with one required and one optional attribute.
variable "user" { type = object({ username = [1] email = [2] }) }
username is required as string, and email is optional as optional(string).
Fill all three blanks to create an object with two optional and one required attribute.
variable "settings" { type = object({ region = [1] timeout = [2] retries = [3] }) }
region is required string, timeout is optional string, and retries is optional number.