2
2
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
3
4
4
locals {
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"
8
8
}
9
9
10
10
data "oci_core_vcn" "vcn" {
11
- # Required
12
- vcn_id = var. vcnOcid
11
+ # Required
12
+ vcn_id = var. vcnOcid
13
13
}
14
14
15
15
data "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
18
18
}
19
19
20
20
data "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
23
23
}
24
24
25
- resource oci_core_route_table private {
25
+ resource " oci_core_route_table" " private" {
26
26
compartment_id = var. ociCompartmentOcid
27
- display_name = " private"
27
+ display_name = " private"
28
28
freeform_tags = {
29
29
}
30
30
route_rules {
@@ -43,55 +43,55 @@ resource oci_core_route_table private {
43
43
}
44
44
45
45
resource "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"
51
51
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"
54
54
}
55
55
56
56
resource "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"
62
62
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"
65
65
}
66
66
67
67
resource "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
75
75
prohibit_public_ip_on_vnic = " false"
76
- dns_label = " svclb"
76
+ dns_label = " svclb"
77
77
}
78
78
79
- resource oci_core_security_list nodepool {
79
+ resource " oci_core_security_list" " nodepool" {
80
80
compartment_id = var. ociCompartmentOcid
81
- display_name = " Node Pool"
81
+ display_name = " Node Pool"
82
82
egress_security_rules {
83
83
description = " Allow pods on one worker node to communicate with pods on other worker nodes"
84
84
destination = local. nodepool_cidr_block
85
85
destination_type = " CIDR_BLOCK"
86
- protocol = " all"
87
- stateless = " false"
86
+ protocol = " all"
87
+ stateless = " false"
88
88
}
89
89
egress_security_rules {
90
90
description = " Access to Kubernetes API Endpoint"
91
91
destination = local. endpoint_cidr_block
92
92
destination_type = " CIDR_BLOCK"
93
- protocol = " 6"
94
- stateless = " false"
93
+ protocol = " 6"
94
+ stateless = " false"
95
95
tcp_options {
96
96
max = " 6443"
97
97
min = " 6443"
@@ -101,8 +101,8 @@ resource oci_core_security_list nodepool {
101
101
description = " Kubernetes worker to control plane communication"
102
102
destination = local. endpoint_cidr_block
103
103
destination_type = " CIDR_BLOCK"
104
- protocol = " 6"
105
- stateless = " false"
104
+ protocol = " 6"
105
+ stateless = " false"
106
106
tcp_options {
107
107
max = " 12250"
108
108
min = " 12250"
@@ -123,8 +123,8 @@ resource oci_core_security_list nodepool {
123
123
description = " Allow nodes to communicate with OKE to ensure correct start-up and continued functioning (0)"
124
124
destination = data. oci_core_services . services . services . 0 . cidr_block
125
125
destination_type = " SERVICE_CIDR_BLOCK"
126
- protocol = " 6"
127
- stateless = " false"
126
+ protocol = " 6"
127
+ stateless = " false"
128
128
tcp_options {
129
129
max = " 443"
130
130
min = " 443"
@@ -145,9 +145,9 @@ resource oci_core_security_list nodepool {
145
145
description = " Worker Nodes access to Internet"
146
146
destination = " 0.0.0.0/0"
147
147
destination_type = " CIDR_BLOCK"
148
- protocol = " all"
149
- stateless = " false"
150
- }
148
+ protocol = " all"
149
+ stateless = " false"
150
+ }
151
151
freeform_tags = {
152
152
}
153
153
ingress_security_rules {
@@ -189,15 +189,15 @@ resource oci_core_security_list nodepool {
189
189
vcn_id = data. oci_core_vcn . vcn . id
190
190
}
191
191
192
- resource oci_core_security_list endpoint {
192
+ resource " oci_core_security_list" " endpoint" {
193
193
compartment_id = var. ociCompartmentOcid
194
- display_name = " Endpoint"
194
+ display_name = " Endpoint"
195
195
egress_security_rules {
196
196
description = " Allow Kubernetes Control Plane to communicate with OKE"
197
197
destination = data. oci_core_services . services . services . 0 . cidr_block
198
198
destination_type = " SERVICE_CIDR_BLOCK"
199
- protocol = " 6"
200
- stateless = " false"
199
+ protocol = " 6"
200
+ stateless = " false"
201
201
tcp_options {
202
202
max = " 443"
203
203
min = " 443"
@@ -207,8 +207,8 @@ resource oci_core_security_list endpoint {
207
207
description = " All traffic to worker nodes"
208
208
destination = local. nodepool_cidr_block
209
209
destination_type = " CIDR_BLOCK"
210
- protocol = " 6"
211
- stateless = " false"
210
+ protocol = " 6"
211
+ stateless = " false"
212
212
}
213
213
egress_security_rules {
214
214
description = " Path discovery"
@@ -270,8 +270,8 @@ resource oci_core_security_list endpoint {
270
270
vcn_id = data. oci_core_vcn . vcn . id
271
271
}
272
272
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"
275
275
manage_default_resource_id = data. oci_core_vcn . vcn . default_security_list_id
276
276
}
277
277
0 commit comments