1
0
Fork 0

make lb group dynamic

This commit is contained in:
Von Random 2024-10-23 00:44:59 +03:00
parent e4bd07fe4a
commit 64bdfbc98f

10
main.tf
View file

@ -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
} }
} }