In Terraform HCL, an object type defined as object({ name = string, age = number }) would match which value?

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

In Terraform HCL, an object type defined as object({ name = string, age = number }) would match which value?

Explanation:
In Terraform, an object type defined as object({ name = string, age = number }) requires an object with two attributes: name must be a string and age must be a number, and both attributes must be present. The value with name = "Alex" and age = 30 satisfies these type constraints exactly: the name is a string and the age is a number. The other options fail because one uses a non-string for name, omits the age attribute, or uses a string where a number is required. Therefore, that value is the one that matches the defined object type.

In Terraform, an object type defined as object({ name = string, age = number }) requires an object with two attributes: name must be a string and age must be a number, and both attributes must be present. The value with name = "Alex" and age = 30 satisfies these type constraints exactly: the name is a string and the age is a number. The other options fail because one uses a non-string for name, omits the age attribute, or uses a string where a number is required. Therefore, that value is the one that matches the defined object type.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy