-
Notifications
You must be signed in to change notification settings - Fork 1
/
load_balancing.tf
57 lines (52 loc) · 1.6 KB
/
load_balancing.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
46
47
48
49
50
51
52
53
54
55
56
57
resource "azurerm_lb" "test" {
name = "${var.load_balancer_name}"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
frontend_ip_configuration {
name = "frontend"
public_ip_address_id = "${azurerm_public_ip.test.id}"
}
}
resource "azurerm_lb_backend_address_pool" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
loadbalancer_id = "${azurerm_lb.test.id}"
name = "BackEndAddressPool"
}
resource "azurerm_lb_nat_pool" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
loadbalancer_id = "${azurerm_lb.test.id}"
name = "LoadBalancerBEAddressNatPool"
protocol = "Tcp"
frontend_port_start = 3389
frontend_port_end = 4500
backend_port = 3389
frontend_ip_configuration_name = "frontend"
}
variable "load_balancer_rules" {
type = "list"
default = [
{
name = "fabric_tcp"
port = 19000
},
{
name = "fabric_http"
port = 19080
},
{
name = "app_http"
port = 80
},
{
name = "app_https"
port = 443
}
]
}
module "load_balancer_rules" {
source = "./load_balancer_rules"
resource_group_name = "${var.resource_group_name}"
load_balancer_id = "${azurerm_lb.test.id}"
backend_address_pool = "${azurerm_lb_backend_address_pool.test.id}"
load_balancer_rules = "${var.load_balancer_rules}"
}