-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadbalancer.tf
More file actions
46 lines (38 loc) · 1.42 KB
/
loadbalancer.tf
File metadata and controls
46 lines (38 loc) · 1.42 KB
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
resource "azurerm_public_ip" "lb_public_ip" {
name = "web-lb-public-ip"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_lb" "web_lb" {
name = "web-load-balancer"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku = "Standard"
frontend_ip_configuration {
name = "frontend-ip"
public_ip_address_id = azurerm_public_ip.lb_public_ip.id
}
}
resource "azurerm_lb_backend_address_pool" "web_backend_pool" {
name = "web-backend-pool"
loadbalancer_id = azurerm_lb.web_lb.id
}
resource "azurerm_lb_probe" "http_probe" {
name = "http-health-probe"
loadbalancer_id = azurerm_lb.web_lb.id
protocol = "Http"
port = 80
request_path = "/"
}
resource "azurerm_lb_rule" "http_rule" {
name = "http-rule"
loadbalancer_id = azurerm_lb.web_lb.id
protocol = "Tcp"
frontend_port = 80
backend_port = 80
frontend_ip_configuration_name = "frontend-ip"
backend_address_pool_ids = [azurerm_lb_backend_address_pool.web_backend_pool.id]
probe_id = azurerm_lb_probe.http_probe.id
}