HashiCorp Certified: Terraform Associate — Question 142
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 use for this input?
Answer options
- A. List
- B. Object
- C. Map
- D. Terraform does not support complex input variables of different types
Correct answer: B
Explanation
The correct answer is B, as an Object can hold different types of values, such as a number for memory and a string for the server name. Options A and C are incorrect because a List and a Map cannot represent mixed data types in the way required. Option D is also incorrect since Terraform does support complex input variables using objects.