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.
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.
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.
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.
d9iceguy
11 months agokareem_ashraf
12 months agoMarch2023
1 year, 5 months agoArnaldoW
1 year, 7 months agoNunyabiznes
1 year, 7 months agostyro
1 year, 7 months agotbhtp
1 year, 7 months agohahano
1 year, 7 months ago