TERRAFORM-ASSOCIATE-004 · Question #177
TERRAFORM-ASSOCIATE-004 Question #177: Real Exam Question with Answer & Explanation
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
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?
Options
- Aaws_instance.web(2),name
- Belement(aws_instance.web, 2)
- Caws_instance-web(1)
- Daws_instance_web(1),name
- EAws_instance,web,* , name
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
Community Discussion
No community discussion yet for this question.