TERRAFORM-ASSOCIATE-004 · Question #25
You want to define a single input variable to capture configuration values for a server. The values must represent memory as a number, and the server name as a string. Which variable type could you us
The correct answer is B. Object. When an input variable must hold multiple named attributes of different types (a number and a string in this case), the correct Terraform type is object. An object type is declared as object({ memory = number, name = string }), allowing each attribute to have its own type constra
Question
Options
- AList
- BObject
- CMap
- DTerraform does not support complex input variables of different types
How the community answered
(30 responses)- B90% (27)
- C7% (2)
- D3% (1)
Explanation
When an input variable must hold multiple named attributes of different types (a number and a string in this case), the correct Terraform type is object. An object type is declared as object({ memory = number, name = string }), allowing each attribute to have its own type constraint. A list (A) is an ordered collection of values all of the same type. A map (C) is also a collection of values of the same type. Terraform absolutely supports complex input variables of mixed types (D is false), using structural types like object and tuple.
Topics
Community Discussion
No community discussion yet for this question.