Skip to content

Commit 440eb33

Browse files
committed
fix: separated ingress rule for operator when create_operator=false
Resolves #693 Signed-off-by: Ali Mukadam <[email protected]>
1 parent 830192e commit 440eb33

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

modules/network/locals.tf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017, 2021 Oracle Corporation and/or affiliates.
1+
# Copyright 2017, 2023 Oracle Corporation and/or affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
locals {
@@ -145,14 +145,6 @@ locals {
145145
source_type = "CIDR_BLOCK",
146146
stateless = false
147147
},
148-
{
149-
description = "Allow operator host access to control plane. Required for kubectl/helm."
150-
protocol = local.tcp_protocol,
151-
port = 6443,
152-
source = local.operator_subnet,
153-
source_type = "CIDR_BLOCK",
154-
stateless = false
155-
},
156148
])
157149

158150
# Network Security Group ingress rules for control plane subnet (Only VCN-Native Pod networking)

modules/network/nsgs.tf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017, 2021, Oracle Corporation and/or affiliates.
1+
# Copyright 2017, 2023, Oracle Corporation and/or affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
# control plane nsg and rules
@@ -85,6 +85,28 @@ resource "oci_core_network_security_group_security_rule" "cp_ingress" {
8585

8686
}
8787

88+
# separate the operator rule for users who do not wish to use the operator
89+
resource "oci_core_network_security_group_security_rule" "cp_ingress_operator" {
90+
network_security_group_id = oci_core_network_security_group.cp.id
91+
description = "Allow operator host access to control plane. Required for kubectl/helm."
92+
direction = "INGRESS"
93+
protocol = local.tcp_protocol
94+
source = local.operator_subnet
95+
source_type = "CIDR_BLOCK"
96+
97+
stateless = false
98+
99+
tcp_options {
100+
destination_port_range {
101+
min = 6443
102+
max = 6443
103+
}
104+
}
105+
106+
count = var.create_operator ? 1: 0
107+
108+
}
109+
88110
resource "oci_core_network_security_group_security_rule" "cp_ingress_additional_cidrs" {
89111
network_security_group_id = oci_core_network_security_group.cp.id
90112
description = "Allow additional CIDR block access to control plane. Required for kubectl/helm."

0 commit comments

Comments
 (0)