-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathload-balancer.tf
45 lines (39 loc) · 1.05 KB
/
load-balancer.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Internal NLB for NAT instances
resource "yandex_lb_network_load_balancer" "s3_nlb" {
folder_id = var.folder_id
name = "s3-nlb"
type = "internal"
listener {
name = "https-listener"
port = 443
internal_address_spec {
subnet_id = yandex_vpc_subnet.nat_vm_subnets[0].id
address = cidrhost(yandex_vpc_subnet.nat_vm_subnets[0].v4_cidr_blocks[0], 100)
}
}
attached_target_group {
target_group_id = yandex_lb_target_group.s3_nat_group.id
healthcheck {
name = "https"
timeout = 2
interval = 3
unhealthy_threshold = 3
healthy_threshold = 3
tcp_options {
port = 443
}
}
}
}
// target group for s3_nlb
resource "yandex_lb_target_group" "s3_nat_group" {
folder_id = var.folder_id
name = "s3-nat-group"
dynamic "target" {
for_each = yandex_compute_instance.nat_vm
content {
subnet_id = target.value.network_interface.0.subnet_id
address = target.value.network_interface.0.ip_address
}
}
}