nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #177

A resource block is shown in the Exhibit space of this page. How would you reference the "name'' value of the second instance of this resource?

The correct answer is D. aws_instance_web(1),name. In Terraform, when you use the count meta-argument, you can reference individual instances using an index. The indexing starts at 0, so to reference the "name" value of the second instance, you would use aws_instance.web[1].name. This syntax allows you to access the properties of

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

Question

A resource block is shown in the Exhibit space of this page. How would you reference the "name'' value of the second instance of this resource?

Exhibit

TERRAFORM-ASSOCIATE-004 question #177 exhibit

Options

  • Aaws_instance.web(2),name
  • Belement(aws_instance.web, 2)
  • Caws_instance-web(1)
  • Daws_instance_web(1),name
  • EAws_instance,web,* , name

How the community answered

(58 responses)
  • A
    9% (5)
  • B
    2% (1)
  • D
    86% (50)
  • E
    3% (2)

Explanation

In Terraform, when you use the count meta-argument, you can reference individual instances using an index. The indexing starts at 0, so to reference the "name" value of the second instance, you would use aws_instance.web[1].name. This syntax allows you to access the properties of specific instances in a list generated by the count argument.

Topics

#Resource Referencing#Resource Instances#HCL Attributes#Terraform Expressions

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice