Terraform Associate Practice Exam

1 / 400

How would you reference the "name" value of the second instance of this fictitious resource?

aws_instance.web[0].name

aws_instance.web[1].name

To reference the "name" value of the second instance of the resource, using an index notation is the correct approach. In most programming and data representation contexts, indexing starts at zero. Therefore, the first item is indexed as [0], the second as [1], and so on.

In this scenario, when discussing the second instance of the fictitious resource known as `aws_instance.web`, you need to access it using the index [1]. This allows Terraform to pull the "name" attribute specifically from that instance. Thus, using `aws_instance.web[1].name` accurately retrieves the desired value of the second instance.

Other options use different indexing or naming conventions that do not correctly point to the intended instance. It's essential to remember that when dealing with arrays or lists in Terraform, zero-based indexing is the standard method for element access.

Get further explanation with Examzify DeepDiveBeta

aws_instance.web.second.name

aws_instance.web[2].name

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy