Skip to content

Commit

Permalink
Merge pull request #51 from Rapha-Borges/fix/network-load-balancer-ba…
Browse files Browse the repository at this point in the history
…ckends

Refactored code to fix the backend definition
  • Loading branch information
Rapha-Borges authored Oct 24, 2024
2 parents f081326 + 248acc3 commit 83847d5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions loadbalancer/loadbalancer.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "oci_core_instances" "instances" {
compartment_id = var.compartment_id
data "oci_containerengine_node_pool" "oke_node_pool" {
node_pool_id = var.node_pool_id
}

resource "oci_network_load_balancer_network_load_balancer" "nlb" {
Expand Down Expand Up @@ -40,17 +40,17 @@ resource "oci_network_load_balancer_backend" "nlb_backend_http" {
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.nlb.id
port = var.node_port_http
depends_on = [oci_network_load_balancer_backend_set.nlb_backend_set_http]
count = var.node_size
target_id = data.oci_core_instances.instances.instances[count.index].id
count = length(data.oci_containerengine_node_pool.oke_node_pool.nodes)
target_id = data.oci_containerengine_node_pool.oke_node_pool.nodes[count.index].id
}

resource "oci_network_load_balancer_backend" "nlb_backend_https" {
backend_set_name = oci_network_load_balancer_backend_set.nlb_backend_set_https.name
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.nlb.id
port = var.node_port_https
depends_on = [oci_network_load_balancer_backend_set.nlb_backend_set_https]
count = var.node_size
target_id = data.oci_core_instances.instances.instances[count.index].id
count = length(data.oci_containerengine_node_pool.oke_node_pool.nodes)
target_id = data.oci_containerengine_node_pool.oke_node_pool.nodes[count.index].id
}

resource "oci_network_load_balancer_listener" "nlb_listener_http" {
Expand Down

0 comments on commit 83847d5

Please sign in to comment.