Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 222 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 222
Topic #: 1
[All Terraform Associate Questions]

How would you refer to the indexing instance from the below configuration?

  • A. aws_instance[“web”][“indexing”]
  • B. aws_instance.web.indexing
  • C. aws_instance-web[“indexing”]
  • D. aws_instance.web[“indexing”]
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
d9iceguy
11 months ago
Selected Answer: D
D is correct https://developer.hashicorp.com/terraform/language/meta-arguments/for_each#referring-to-instances
upvoted 2 times
...
kareem_ashraf
12 months ago
Selected Answer: D
Referring to Instances with multiple instances are prefixed with module.<NAME>[<KEY>] when displayed in plan output and elsewhere in the UI. For a module without count or for_each, the address will not contain the module index as the module's name suffices to reference the module.
upvoted 3 times
...
March2023
1 year, 5 months ago
Selected Answer: D
Just tested, the answer is D
upvoted 2 times
...
ArnaldoW
1 year, 7 months ago
The correct one is D. It's involving for_each. In summary, both notations refer to the same resource instance but use different syntax to access it. The bracket notation is used for dynamic access, whereas the dot notation is used for direct access.
upvoted 2 times
...
Nunyabiznes
1 year, 7 months ago
Selected Answer: D
aws_instance.web["indexing"]
upvoted 3 times
...
styro
1 year, 7 months ago
Selected Answer: D
D. aws_instance.web[“indexing”] To refer to the “indexing” instance in the given configuration, you would use the resource type followed by the resource name, and then use the index key in square brackets. The correct syntax is: aws_instance.web["indexing"] This refers to the “indexing” instance created by the aws_instance resource named “web”. The other options provided do not use the correct syntax for referencing resources with for_each keys in Terraform.
upvoted 1 times
...
tbhtp
1 year, 7 months ago
The correct answer is B.
upvoted 1 times
...
hahano
1 year, 7 months ago
Selected Answer: B
the answer is B
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

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.

SaveCancel
Loading ...