Which of the following is not a valid Terraform variable type?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which of the following is not a valid Terraform variable type?

Explanation:
In Terraform, you declare variable types using primitive types like string, number, and bool, plus complex types expressed with syntax such as list(type), map(type), set(type), object({...}), and tuple([...]). There isn’t a top-level type called array. To represent a sequence of elements, you use list, not array. So a variable declared as type = array would be invalid. For example, valid declarations include type = string, type = list(string), type = map(number), type = set(string), type = object({ name = string, enabled = bool }), or type = tuple([string, number]). This is why array is not a valid Terraform variable type.

In Terraform, you declare variable types using primitive types like string, number, and bool, plus complex types expressed with syntax such as list(type), map(type), set(type), object({...}), and tuple([...]). There isn’t a top-level type called array. To represent a sequence of elements, you use list, not array. So a variable declared as type = array would be invalid. For example, valid declarations include type = string, type = list(string), type = map(number), type = set(string), type = object({ name = string, enabled = bool }), or type = tuple([string, number]). This is why array is not a valid Terraform variable type.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy