make lb group dynamic
This commit is contained in:
		
							parent
							
								
									e4bd07fe4a
								
							
						
					
					
						commit
						64bdfbc98f
					
				
					 1 changed files with 6 additions and 8 deletions
				
			
		
							
								
								
									
										14
									
								
								main.tf
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								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" {
 | 
				
			||||||
    subnet_id = yandex_vpc_subnet.subnet1.id
 | 
					    for_each = yandex_compute_instance.vm
 | 
				
			||||||
    address = yandex_compute_instance.vm[0].network_interface.0.ip_address
 | 
					    content {
 | 
				
			||||||
  }
 | 
					      subnet_id = yandex_vpc_subnet.subnet1.id
 | 
				
			||||||
 | 
					      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…
	
	Add table
		Add a link
		
	
		Reference in a new issue