github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/lang/globalref/testdata/contributing-resources/compute/contributing-resources-compute.tf (about) 1 variable "network" { 2 type = object({ 3 vpc_id = string 4 subnet_ids = map(string) 5 }) 6 } 7 8 resource "test_thing" "controller" { 9 for_each = var.network.subnet_ids 10 11 string = each.value 12 } 13 14 locals { 15 workers = flatten([ 16 for k, id in var.network_subnet_ids : [ 17 for n in range(3) : { 18 unique_key = "${k}:${n}" 19 subnet_id = n 20 } 21 ] 22 ]) 23 24 controllers = test_thing.controller 25 } 26 27 resource "test_thing" "worker" { 28 for_each = { for o in local.workers : o.unique_key => o.subnet_id } 29 30 string = each.value 31 32 dynamic "list" { 33 for_each = test_thing.controller 34 content { 35 z = list.value.string 36 } 37 } 38 } 39 40 resource "test_thing" "load_balancer" { 41 string = var.network.vpc_id 42 43 dynamic "list" { 44 for_each = local.controllers 45 content { 46 z = list.value.string 47 } 48 } 49 } 50 51 output "compuneetees_api_url" { 52 value = test_thing.load_balancer.string 53 }