Exam Terraform-Associate-004 Topic 7 Question 295 Discussion
Actual exam question for HashiCorp's Terraform-Associate-004 exam
Question #: 295
Topic #: 7
Question #: 295
Topic #: 7
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.


Suggested Answer: B Vote an answer
From the official Terraform Type Constraints Documentation:
The object({ name = string, age = number }) type expects:
name to be aquoted string, e.g. " John "
age to be anumber, e.g. 52
Option Bsatisfies both:
{
name = " John " ##Valid string
age = 52 ##Valid number
}
Let ' s analyze the incorrect ones:
#Option A: " fifty two " is not a valid number.
#Option C: John is unquoted (invalid string), and " fifty two " is not a number.
#Option D: name = John is not quoted, making it an invalid string in HCL.
Terraform is strict about type and formatting. Stringsmust be quoted, and numbersmust be numeric literals.
The object({ name = string, age = number }) type expects:
name to be aquoted string, e.g. " John "
age to be anumber, e.g. 52
Option Bsatisfies both:
{
name = " John " ##Valid string
age = 52 ##Valid number
}
Let ' s analyze the incorrect ones:
#Option A: " fifty two " is not a valid number.
#Option C: John is unquoted (invalid string), and " fifty two " is not a number.
#Option D: name = John is not quoted, making it an invalid string in HCL.
Terraform is strict about type and formatting. Stringsmust be quoted, and numbersmust be numeric literals.
by Clyde at Jun 19, 2026, 09:00 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).