-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlb.tf
64 lines (55 loc) · 2.46 KB
/
lb.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
58
59
60
61
62
63
64
resource "azurerm_public_ip" "jenkins_loadbalancer_publicip" {
name = "${var.config["lb_pip_name"]}"
resource_group_name = "${azurerm_resource_group.res_group.name}"
location = "${azurerm_resource_group.res_group.location}"
#public_ip_address_allocation = "dynamic"
public_ip_address_allocation = "static"
#domain_name_label = "${var.config["lb_ip_dns_name"]}"
}
resource "azurerm_lb" "jenkins_lb" {
name = "jenkins_lb"
resource_group_name = "${azurerm_resource_group.res_group.name}"
location = "${azurerm_resource_group.res_group.location}"
frontend_ip_configuration {
name = "jenkins_lb_frontend"
public_ip_address_id = "${azurerm_public_ip.jenkins_loadbalancer_publicip.id}"
}
}
resource "azurerm_lb_backend_address_pool" "jenkins_lb_backend" {
name = "jenkins_lb_backend"
resource_group_name = "${azurerm_resource_group.res_group.name}"
loadbalancer_id = "${azurerm_lb.jenkins_lb.id}"
}
resource "azurerm_lb_probe" "lb_probe" {
resource_group_name = "${azurerm_resource_group.res_group.name}"
loadbalancer_id = "${azurerm_lb.jenkins_lb.id}"
name = "tcpProbe"
protocol = "tcp"
port = 8080
interval_in_seconds = 5
number_of_probes = 2
}
resource "azurerm_lb_rule" "lb_http_rule" {
resource_group_name = "${azurerm_resource_group.res_group.name}"
loadbalancer_id = "${azurerm_lb.jenkins_lb.id}"
name = "LBRule"
protocol = "tcp"
frontend_port = 80
backend_port = 8080
frontend_ip_configuration_name = "jenkins_lb_frontend"
enable_floating_ip = false
backend_address_pool_id = "${azurerm_lb_backend_address_pool.jenkins_lb_backend.id}"
idle_timeout_in_minutes = 5
probe_id = "${azurerm_lb_probe.lb_probe.id}"
depends_on = ["azurerm_lb_probe.lb_probe"]
}
resource "azurerm_lb_nat_rule" "lb_ssh_rule" {
resource_group_name = "${azurerm_resource_group.res_group.name}"
loadbalancer_id = "${azurerm_lb.jenkins_lb.id}"
name = "SSH-VM-01"
protocol = "tcp"
frontend_port = "50001"
backend_port = 22
frontend_ip_configuration_name = "jenkins_lb_frontend"
count = 2
}