Skip to content

Commit ea25d4d

Browse files
committed
5G NF Infra example - vnic attachments
Signed-off-by: junior <junior@users.noreply.github.com>
1 parent 150029b commit ea25d4d

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

examples/5G-NF-Infra/networking.tf

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,68 @@ locals {
247247
ipv6cidr_block = null
248248
},
249249
]
250-
}
250+
}
251+
252+
# Node Pool 1 info for 5G VNICs attachments
253+
data "oci_containerengine_node_pool" "node_pool_1" {
254+
node_pool_id = module.oke-quickstart.oke_node_pools["pool1"].node_pool_id
255+
}
256+
locals {
257+
node_pool_nodes = data.oci_containerengine_node_pool.node_pool_1.nodes
258+
node_pool_nodes_ids = data.oci_containerengine_node_pool.node_pool_1.nodes.*.id
259+
}
260+
resource "oci_core_vnic_attachment" "vnic_attachment_5gc_oam" {
261+
for_each = { for map in local.node_pool_nodes : map.id => map }
262+
create_vnic_details {
263+
display_name = "5GC-OAM vnic"
264+
private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5GC-OAM-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)]
265+
subnet_id = module.oke-quickstart.subnets["5GC_OAM_subnet"].subnet_id
266+
defined_tags = {}
267+
freeform_tags = { "Network" : "5GC-OAM" }
268+
}
269+
instance_id = each.value.id
270+
}
271+
resource "oci_core_vnic_attachment" "vnic_attachment_5gc_signalling" {
272+
for_each = { for map in local.node_pool_nodes : map.id => map }
273+
create_vnic_details {
274+
display_name = "5GC-Signalling vnic"
275+
private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5GC-SIGNALLING-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)]
276+
subnet_id = module.oke-quickstart.subnets["5GC_Signalling_subnet"].subnet_id
277+
defined_tags = {}
278+
freeform_tags = { "Network" : "5GC-Signalling" }
279+
}
280+
instance_id = each.value.id
281+
}
282+
resource "oci_core_vnic_attachment" "vnic_attachment_5g_ran" {
283+
for_each = { for map in local.node_pool_nodes : map.id => map }
284+
create_vnic_details {
285+
display_name = "5G RAN vnic"
286+
private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5G-RAN-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)]
287+
subnet_id = module.oke-quickstart.subnets["5G_RAN_subnet"].subnet_id
288+
defined_tags = {}
289+
freeform_tags = { "Network" : "5G RAN" }
290+
}
291+
instance_id = each.value.id
292+
}
293+
resource "oci_core_vnic_attachment" "vnic_attachment_5g_legal_intercept" {
294+
for_each = { for map in local.node_pool_nodes : map.id => map }
295+
create_vnic_details {
296+
display_name = "5G Legal Intercept vnic"
297+
private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-LEGAL-INTERCEPT-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)]
298+
subnet_id = module.oke-quickstart.subnets["Legal_Intercept_subnet"].subnet_id
299+
defined_tags = {}
300+
freeform_tags = { "Network" : "5G Legal Intercept" }
301+
}
302+
instance_id = each.value.id
303+
}
304+
resource "oci_core_vnic_attachment" "vnic_attachment_5g_epc" {
305+
for_each = { for map in local.node_pool_nodes : map.id => map }
306+
create_vnic_details {
307+
display_name = "5G-EPC vnic"
308+
private_ip = [for hostnum in range(4, 15) : cidrhost(lookup(local.network_cidrs, "SUBNET-5G-EPC-CIDR"), hostnum)][index(local.node_pool_nodes_ids, each.key)]
309+
subnet_id = module.oke-quickstart.subnets["5G_EPC_subnet"].subnet_id
310+
defined_tags = {}
311+
freeform_tags = { "Network" : "5G-EPC" }
312+
}
313+
instance_id = each.value.id
314+
}

examples/5G-NF-Infra/oke.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# OKE Cluster
77
################################################################################
88
module "oke-quickstart" {
9-
source = "github.com/oracle-quickstart/terraform-oci-oke-quickstart?ref=0.8.9"
9+
source = "github.com/oracle-quickstart/terraform-oci-oke-quickstart?ref=0.8.10"
1010

1111
# Oracle Cloud Infrastructure Tenancy and Compartment OCID
1212
tenancy_ocid = var.tenancy_ocid

0 commit comments

Comments
 (0)