forked from garutilorenzo/oracle-cloud-terraform-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lb.tf
82 lines (67 loc) · 2.88 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
resource "oci_network_load_balancer_network_load_balancer" "k3s_load_balancer" {
depends_on = [
oci_core_instance_pool.k3s_agents,
]
compartment_id = var.compartment_ocid
display_name = "k3s load balancer"
subnet_id = oci_core_subnet.oci_core_subnet11.id
is_private = false
is_preserve_source_destination = false
freeform_tags = {
"${var.tutorial_tag_key}" = "${var.tutorial_tag_value}"
}
}
resource "oci_network_load_balancer_listener" "k3s_http_listener" {
default_backend_set_name = oci_network_load_balancer_backend_set.k3s_http_backend_set.name
name = "k3s http listener"
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
port = 80
protocol = "TCP"
}
resource "oci_network_load_balancer_listener" "k3s_https_listener" {
default_backend_set_name = oci_network_load_balancer_backend_set.k3s_https_backend_set.name
name = "k3s https listener"
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
port = 443
protocol = "TCP"
}
resource "oci_network_load_balancer_backend_set" "k3s_http_backend_set" {
health_checker {
protocol = "TCP"
port = 80
}
name = "k3s http backend"
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
policy = "FIVE_TUPLE"
is_preserve_source = true
}
resource "oci_network_load_balancer_backend_set" "k3s_https_backend_set" {
health_checker {
protocol = "TCP"
port = 80
}
name = "k3s https backend"
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
policy = "FIVE_TUPLE"
is_preserve_source = true
}
resource "oci_network_load_balancer_backend" "k3s_http_backend" {
depends_on = [
oci_core_instance_pool.k3s_agents,
]
count = var.instance_pool_size
backend_set_name = oci_network_load_balancer_backend_set.k3s_http_backend_set.name
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
port = 80
target_id = data.oci_core_instance_pool_instances.k3s_agents_instances.instances[count.index].id
}
resource "oci_network_load_balancer_backend" "k3s_https_backend" {
depends_on = [
oci_core_instance_pool.k3s_agents,
]
count = var.instance_pool_size
backend_set_name = oci_network_load_balancer_backend_set.k3s_https_backend_set.name
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
port = 443
target_id = data.oci_core_instance_pool_instances.k3s_agents_instances.instances[count.index].id
}