2020-07-09 14:54:42 -05:00
|
|
|
data "test_data_source" "bar" {
|
|
|
|
for_each = {
|
|
|
|
a = "b"
|
|
|
|
}
|
|
|
|
foo = "zing"
|
|
|
|
}
|
|
|
|
|
2020-07-07 10:08:14 -05:00
|
|
|
data "test_data_source" "foo" {
|
2020-07-09 14:54:42 -05:00
|
|
|
for_each = data.test_data_source.bar
|
2020-07-07 10:08:14 -05:00
|
|
|
foo = "ok"
|
2014-07-28 12:43:00 -05:00
|
|
|
}
|
|
|
|
|
2020-07-07 10:08:14 -05:00
|
|
|
locals {
|
|
|
|
l = [
|
|
|
|
{
|
2020-07-09 14:54:42 -05:00
|
|
|
name = data.test_data_source.foo["a"].id
|
2020-07-07 10:08:14 -05:00
|
|
|
val = "null"
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
m = { for v in local.l :
|
|
|
|
v.name => v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "test_instance" "bar" {
|
|
|
|
for_each = local.m
|
|
|
|
foo = format("%s", each.value.name)
|
|
|
|
dep = each.value.val
|
2014-07-28 12:43:00 -05:00
|
|
|
}
|
|
|
|
|
2020-07-07 10:08:14 -05:00
|
|
|
output "out" {
|
|
|
|
value = test_instance.bar
|
2014-07-28 12:43:00 -05:00
|
|
|
}
|