Skip to content

Commit b622110

Browse files
authored
Merge pull request #1 from oracle-quickstart/bugfix/lb-sec-lists
fix issue on lb sec-lists
2 parents 7947ece + 7f256f2 commit b622110

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

network.tf

+8-9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
locals {
55
subnet_cidrs = cidrsubnets(var.vcn_cidr, 12, 8, 4, 4, 4) # API + 1 LB + 3 node pools
66
api_subnet_cidr = element(local.subnet_cidrs, 0)
7-
public_lb_subnet_cidr = element(local.subnet_cidrs, 1)
8-
lb_subnets_cidrs = element(local.subnet_cidrs, 2) # [for k, v in zipmap(slice(local.subnet_cidrs, 1, 3), [var.allow_deploy_public_lb, var.allow_deploy_private_lb]) : k if v]
7+
lb_subnet_cidr = element(local.subnet_cidrs, 1)
98
node_pool_subnets_cidrs = slice(local.subnet_cidrs, 2, 5)
109
ADs = data.oci_identity_availability_domains.ADs.availability_domains.*.name
1110
}
@@ -337,7 +336,7 @@ resource "oci_core_security_list" "oke_nodepool_lb_comm_sec_list" {
337336
description = "TCP to LBs"
338337
protocol = "6"
339338
destination_type = "CIDR_BLOCK"
340-
destination = local.lb_subnets_cidrs
339+
destination = local.lb_subnet_cidr
341340
stateless = false
342341
# }
343342
}
@@ -348,7 +347,7 @@ resource "oci_core_security_list" "oke_nodepool_lb_comm_sec_list" {
348347
# content {
349348
description = "TCP from LBs"
350349
protocol = "6"
351-
source = local.lb_subnets_cidrs
350+
source = local.lb_subnet_cidr
352351
stateless = false
353352
# }
354353
}
@@ -371,18 +370,18 @@ resource "oci_core_subnet" "oke_api_endpoint_subnet" {
371370
defined_tags = var.vcn_tags
372371
}
373372

374-
resource "oci_core_subnet" "oke_public_lb_subnet" {
375-
count = (var.use_existing_vcn && !var.allow_deploy_public_lb) ? 0 : 1
376-
cidr_block = local.public_lb_subnet_cidr
373+
resource "oci_core_subnet" "oke_lb_subnet" {
374+
count = (var.use_existing_vcn) ? 0 : 1
375+
cidr_block = local.lb_subnet_cidr
377376
compartment_id = var.vcn_compartment_id
378377
availability_domain = null
379378
vcn_id = oci_core_vcn.oke_vcn[0].id
380379
dns_label = "lb"
381-
display_name = "Services Public LBs Subnet"
380+
display_name = "Services LBs Subnet"
382381

383382
security_list_ids = [oci_core_vcn.oke_vcn[0].default_security_list_id]
384383
route_table_id = oci_core_route_table.oke_rt_via_igw[0].id
385-
prohibit_public_ip_on_vnic = false
384+
prohibit_public_ip_on_vnic = !var.allow_deploy_public_lb
386385
defined_tags = var.vcn_tags
387386
}
388387

oke_cluster.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ resource "oci_containerengine_cluster" "oci_oke_cluster" {
3333

3434
options {
3535
# service_lb_subnet_ids = var.use_existing_vcn ? [for k, v in zipmap([var.public_lb_subnet, var.private_lb_subnet], [var.allow_deploy_public_lb, var.allow_deploy_private_lb]) : k if v] : [for k, v in zipmap([oci_core_subnet.oke_public_lb_subnet[0].id, oci_core_subnet.oke_private_lb_subnet[0].id], [var.allow_deploy_public_lb, var.allow_deploy_private_lb]) : k if v]
36-
service_lb_subnet_ids = var.allow_deploy_public_lb ? (var.use_existing_vcn ? [var.public_lb_subnet] : [oci_core_subnet.oke_public_lb_subnet[0].id]) : []
36+
service_lb_subnet_ids = var.use_existing_vcn ? [var.public_lb_subnet] : [oci_core_subnet.oke_lb_subnet[0].id]
3737

3838
add_ons {
3939
is_kubernetes_dashboard_enabled = var.cluster_options_add_ons_is_kubernetes_dashboard_enabled

oke_node_pools.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ resource "oci_containerengine_node_pool" "oci_oke_node_pool" {
5858
cluster_id = oci_containerengine_cluster.oci_oke_cluster.id
5959
compartment_id = var.cluster_compartment_id
6060
kubernetes_version = var.kubernetes_version != "" ? var.kubernetes_version : reverse(data.oci_containerengine_cluster_option.cluster_options.kubernetes_versions)[0]
61-
name = "${local.node_pools[count.index]["node_shape"]} Node Pool"
61+
name = "${local.node_pools[count.index]["node_shape"]}_Node_Pool"
6262
node_shape = local.node_pools[count.index]["node_shape"]
6363

6464
# initial_node_labels {

0 commit comments

Comments
 (0)