github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/testdata/apply-multi-var-order-interp/main.tf (about) 1 variable "num" { 2 default = 15 3 } 4 5 resource "aws_instance" "bar" { 6 count = "${var.num}" 7 foo = "index-${count.index}" 8 } 9 10 resource "aws_instance" "baz" { 11 count = "${var.num}" 12 foo = "baz-${element(aws_instance.bar.*.foo, count.index)}" 13 } 14 15 output "should-be-11" { 16 value = "${element(aws_instance.baz.*.foo, 11)}" 17 }