make lb group dynamic
This commit is contained in:
parent
e4bd07fe4a
commit
64bdfbc98f
1 changed files with 6 additions and 8 deletions
10
main.tf
10
main.tf
|
@ -47,14 +47,12 @@ resource "yandex_vpc_subnet" "subnet1" {
|
||||||
|
|
||||||
resource "yandex_lb_target_group" "group1" {
|
resource "yandex_lb_target_group" "group1" {
|
||||||
name = "group1"
|
name = "group1"
|
||||||
target {
|
dynamic "target" {
|
||||||
|
for_each = yandex_compute_instance.vm
|
||||||
|
content {
|
||||||
subnet_id = yandex_vpc_subnet.subnet1.id
|
subnet_id = yandex_vpc_subnet.subnet1.id
|
||||||
address = yandex_compute_instance.vm[0].network_interface.0.ip_address
|
address = target.value.network_interface.0.ip_address
|
||||||
}
|
}
|
||||||
|
|
||||||
target {
|
|
||||||
subnet_id = yandex_vpc_subnet.subnet1.id
|
|
||||||
address = yandex_compute_instance.vm[1].network_interface.0.ip_address
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue