HashiCorp Terraform Associate Practice Exam 2026 - Free Terraform Associate Exam Practice Questions and Study Guide

Session length

1 / 20

How would you reference the name value of the second aws_instance.web instance?

element(aws_instance.web, 2)

aws_instance.web[1].name

When you create multiple instances with count, Terraform exposes them as a list under the resource name. To get the second instance, you reference index 1, and to read a specific attribute of that instance you append .name. So aws_instance.web[1].name returns the name value of the second aws_instance.web instance.

The other forms don’t target the second instance’s attribute correctly: element(aws_instance.web, 2) isn’t the right way to pick a property from a resource with count, aws_instance.web[1] would give you the second instance object but not its name, and aws_instance.web[0].name would give the first instance’s name, not the second.

aws_instance.web[1]

aws_instance.web[0].name

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy