nerdexam
HashiCorp

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

Submitted by hans_de· Apr 18, 2026Work with Terraform Configurations

Question

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?

Options

  • AList
  • BObject
  • CMap
  • DTerraform does not support complex input variables of different types

How the community answered

(30 responses)
  • B
    90% (27)
  • C
    7% (2)
  • D
    3% (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

#Input Variables#Variable Types#Complex Types#Object Type

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice