@@ -6,12 +6,10 @@ resource "oci_core_network_security_group" "operator" {
66 compartment_id = var. compartment_id
77 display_name = " ${ var . label_prefix } -operator"
88 vcn_id = var. vcn_id
9-
10- count = var. create_operator == true ? 1 : 0
119}
1210
1311resource "oci_core_network_security_group_security_rule" "operator_egress_anywhere" {
14- network_security_group_id = oci_core_network_security_group. operator [ 0 ] . id
12+ network_security_group_id = oci_core_network_security_group. operator . id
1513 description = " allow operator to egress to anywhere"
1614 destination = local. anywhere
1715 destination_type = " CIDR_BLOCK"
@@ -22,12 +20,10 @@ resource "oci_core_network_security_group_security_rule" "operator_egress_anywhe
2220 lifecycle {
2321 ignore_changes = [direction , protocol , source , source_type , tcp_options ]
2422 }
25-
26- count = var. create_operator == true ? 1 : 0
2723}
2824
2925resource "oci_core_network_security_group_security_rule" "operator_egress_osn" {
30- network_security_group_id = oci_core_network_security_group. operator [ 0 ] . id
26+ network_security_group_id = oci_core_network_security_group. operator . id
3127 description = " allow operator to egress to osn"
3228 destination = local. osn
3329 destination_type = " SERVICE_CIDR_BLOCK"
@@ -38,12 +34,10 @@ resource "oci_core_network_security_group_security_rule" "operator_egress_osn" {
3834 lifecycle {
3935 ignore_changes = [direction , protocol , source , source_type , tcp_options ]
4036 }
41-
42- count = var. create_operator == true ? 1 : 0
4337}
4438
4539resource "oci_core_network_security_group_security_rule" "operator_ingress" {
46- network_security_group_id = oci_core_network_security_group. operator [ 0 ] . id
40+ network_security_group_id = oci_core_network_security_group. operator . id
4741 description = " allow ssh access to operator from within vcn"
4842 direction = " INGRESS"
4943 protocol = local. tcp_protocol
@@ -61,6 +55,23 @@ resource "oci_core_network_security_group_security_rule" "operator_ingress" {
6155 lifecycle {
6256 ignore_changes = [direction , protocol , source , source_type , tcp_options ]
6357 }
58+ }
59+
60+ resource "oci_core_security_list" "operator" {
61+ compartment_id = var. compartment_id
62+ display_name = var. label_prefix == " none" ? " operator" : " ${ var . label_prefix } -operator"
63+ freeform_tags = var. tags
64+
65+ # egress rule to the same subnet to allow users to use OCI Bastion service to connect to the operator
66+ egress_security_rules {
67+ protocol = local. tcp_protocol
68+ destination = local. operator_subnet
69+
70+ tcp_options {
71+ min = local. ssh_port
72+ max = local. ssh_port
73+ }
74+ }
6475
65- count = var. create_operator == true ? 1 : 0
76+ vcn_id = var. vcn_id
6677}
0 commit comments