22// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
44locals {
5- endpoint_cidr_block = " 10.0.0.0/28"
6- nodepool_cidr_block = " 10.0.10.0/24"
7- svclb_cidr_block = " 10.0.20.0/24"
5+ endpoint_cidr_block = " 10.0.0.0/28"
6+ nodepool_cidr_block = " 10.0.10.0/24"
7+ svclb_cidr_block = " 10.0.20.0/24"
88}
99
1010data "oci_core_vcn" "vcn" {
11- # Required
12- vcn_id = var. vcnOcid
11+ # Required
12+ vcn_id = var. vcnOcid
1313}
1414
1515data "oci_core_nat_gateways" "ngws" {
16- compartment_id = var. ociCompartmentOcid
17- vcn_id = data. oci_core_vcn . vcn . id
16+ compartment_id = var. ociCompartmentOcid
17+ vcn_id = data. oci_core_vcn . vcn . id
1818}
1919
2020data "oci_core_service_gateways" "sgs" {
21- compartment_id = var. ociCompartmentOcid
22- vcn_id = data. oci_core_vcn . vcn . id
21+ compartment_id = var. ociCompartmentOcid
22+ vcn_id = data. oci_core_vcn . vcn . id
2323}
2424
25- resource oci_core_route_table private {
25+ resource " oci_core_route_table" " private" {
2626 compartment_id = var. ociCompartmentOcid
27- display_name = " private"
27+ display_name = " private"
2828 freeform_tags = {
2929 }
3030 route_rules {
@@ -43,55 +43,55 @@ resource oci_core_route_table private {
4343}
4444
4545resource "oci_core_subnet" "endpoint" {
46- cidr_block = local. endpoint_cidr_block
47- compartment_id = var. ociCompartmentOcid
48- vcn_id = data. oci_core_vcn . vcn . id
49- security_list_ids = [oci_core_security_list . endpoint . id ]
50- display_name = " Endpoint"
46+ cidr_block = local. endpoint_cidr_block
47+ compartment_id = var. ociCompartmentOcid
48+ vcn_id = data. oci_core_vcn . vcn . id
49+ security_list_ids = [oci_core_security_list . endpoint . id ]
50+ display_name = " Endpoint"
5151 prohibit_public_ip_on_vnic = " false"
52- route_table_id = data. oci_core_vcn . vcn . default_route_table_id
53- dns_label = " endpoint"
52+ route_table_id = data. oci_core_vcn . vcn . default_route_table_id
53+ dns_label = " endpoint"
5454}
5555
5656resource "oci_core_subnet" "nodepool" {
57- cidr_block = local. nodepool_cidr_block
58- compartment_id = var. ociCompartmentOcid
59- vcn_id = data. oci_core_vcn . vcn . id
60- security_list_ids = [oci_core_security_list . nodepool . id ]
61- display_name = " Node Pool"
57+ cidr_block = local. nodepool_cidr_block
58+ compartment_id = var. ociCompartmentOcid
59+ vcn_id = data. oci_core_vcn . vcn . id
60+ security_list_ids = [oci_core_security_list . nodepool . id ]
61+ display_name = " Node Pool"
6262 prohibit_public_ip_on_vnic = " true"
63- route_table_id = oci_core_route_table. private . id
64- dns_label = " nodepool"
63+ route_table_id = oci_core_route_table. private . id
64+ dns_label = " nodepool"
6565}
6666
6767resource "oci_core_subnet" "svclb" {
68- cidr_block = local. svclb_cidr_block
69- compartment_id = var. ociCompartmentOcid
70- vcn_id = data. oci_core_vcn . vcn . id
71- security_list_ids = [data . oci_core_vcn . vcn . default_security_list_id ]
72- display_name = " Service Load Balancer"
73- route_table_id = data. oci_core_vcn . vcn . default_route_table_id
74- dhcp_options_id = data. oci_core_vcn . vcn . default_dhcp_options_id
68+ cidr_block = local. svclb_cidr_block
69+ compartment_id = var. ociCompartmentOcid
70+ vcn_id = data. oci_core_vcn . vcn . id
71+ security_list_ids = [data . oci_core_vcn . vcn . default_security_list_id ]
72+ display_name = " Service Load Balancer"
73+ route_table_id = data. oci_core_vcn . vcn . default_route_table_id
74+ dhcp_options_id = data. oci_core_vcn . vcn . default_dhcp_options_id
7575 prohibit_public_ip_on_vnic = " false"
76- dns_label = " svclb"
76+ dns_label = " svclb"
7777}
7878
79- resource oci_core_security_list nodepool {
79+ resource " oci_core_security_list" " nodepool" {
8080 compartment_id = var. ociCompartmentOcid
81- display_name = " Node Pool"
81+ display_name = " Node Pool"
8282 egress_security_rules {
8383 description = " Allow pods on one worker node to communicate with pods on other worker nodes"
8484 destination = local. nodepool_cidr_block
8585 destination_type = " CIDR_BLOCK"
86- protocol = " all"
87- stateless = " false"
86+ protocol = " all"
87+ stateless = " false"
8888 }
8989 egress_security_rules {
9090 description = " Access to Kubernetes API Endpoint"
9191 destination = local. endpoint_cidr_block
9292 destination_type = " CIDR_BLOCK"
93- protocol = " 6"
94- stateless = " false"
93+ protocol = " 6"
94+ stateless = " false"
9595 tcp_options {
9696 max = " 6443"
9797 min = " 6443"
@@ -101,8 +101,8 @@ resource oci_core_security_list nodepool {
101101 description = " Kubernetes worker to control plane communication"
102102 destination = local. endpoint_cidr_block
103103 destination_type = " CIDR_BLOCK"
104- protocol = " 6"
105- stateless = " false"
104+ protocol = " 6"
105+ stateless = " false"
106106 tcp_options {
107107 max = " 12250"
108108 min = " 12250"
@@ -123,8 +123,8 @@ resource oci_core_security_list nodepool {
123123 description = " Allow nodes to communicate with OKE to ensure correct start-up and continued functioning (0)"
124124 destination = data. oci_core_services . services . services . 0 . cidr_block
125125 destination_type = " SERVICE_CIDR_BLOCK"
126- protocol = " 6"
127- stateless = " false"
126+ protocol = " 6"
127+ stateless = " false"
128128 tcp_options {
129129 max = " 443"
130130 min = " 443"
@@ -145,9 +145,9 @@ resource oci_core_security_list nodepool {
145145 description = " Worker Nodes access to Internet"
146146 destination = " 0.0.0.0/0"
147147 destination_type = " CIDR_BLOCK"
148- protocol = " all"
149- stateless = " false"
150- }
148+ protocol = " all"
149+ stateless = " false"
150+ }
151151 freeform_tags = {
152152 }
153153 ingress_security_rules {
@@ -189,15 +189,15 @@ resource oci_core_security_list nodepool {
189189 vcn_id = data. oci_core_vcn . vcn . id
190190}
191191
192- resource oci_core_security_list endpoint {
192+ resource " oci_core_security_list" " endpoint" {
193193 compartment_id = var. ociCompartmentOcid
194- display_name = " Endpoint"
194+ display_name = " Endpoint"
195195 egress_security_rules {
196196 description = " Allow Kubernetes Control Plane to communicate with OKE"
197197 destination = data. oci_core_services . services . services . 0 . cidr_block
198198 destination_type = " SERVICE_CIDR_BLOCK"
199- protocol = " 6"
200- stateless = " false"
199+ protocol = " 6"
200+ stateless = " false"
201201 tcp_options {
202202 max = " 443"
203203 min = " 443"
@@ -207,8 +207,8 @@ resource oci_core_security_list endpoint {
207207 description = " All traffic to worker nodes"
208208 destination = local. nodepool_cidr_block
209209 destination_type = " CIDR_BLOCK"
210- protocol = " 6"
211- stateless = " false"
210+ protocol = " 6"
211+ stateless = " false"
212212 }
213213 egress_security_rules {
214214 description = " Path discovery"
@@ -270,8 +270,8 @@ resource oci_core_security_list endpoint {
270270 vcn_id = data. oci_core_vcn . vcn . id
271271}
272272
273- resource oci_core_default_security_list svcLB {
274- display_name = " Service Load Balancer"
273+ resource " oci_core_default_security_list" " svcLB" {
274+ display_name = " Service Load Balancer"
275275 manage_default_resource_id = data. oci_core_vcn . vcn . default_security_list_id
276276}
277277
0 commit comments