Skip to content

Commit f94cebe

Browse files
authored
Merge pull request #2005 from oracle-devrel/oke-rm
oke-rm-1.1.5
2 parents 90a1522 + 60739e9 commit f94cebe

File tree

13 files changed

+143
-63
lines changed

13 files changed

+143
-63
lines changed

app-dev/devops-and-containers/oke/oke-rm/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ This stack is used to create the initial network infrastructure for OKE. When co
1616
* By default, everything is private, but there is the possibility to create public subnets
1717
* Be careful when modifying the default values, as inputs are not validated
1818

19-
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/releases/download/oke-rm-1.1.4/infra.zip)
19+
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/releases/download/oke-rm-1.1.5/infra.zip)
2020

2121
## Step 2: Create the OKE control plane
2222

2323
This stack is used to create the OKE control plane ONLY.
2424

25-
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/releases/download/oke-rm-1.1.4/oke.zip)
25+
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/releases/download/oke-rm-1.1.5/oke.zip)
2626

2727
Also note that if the network infrastructure is located in a different compartment than the OKE cluster AND you are planning to use the OCI_VCN_NATIVE CNI,
2828
you must add these policies:
-1.36 KB
Binary file not shown.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
locals {
2-
create_bastion = var.create_bastion_subnet && var.create_bastion
32
# VCN_NATIVE_CNI internally it is mapped as npn
43
cni = var.cni_type == "vcn_native" ? "npn" : var.cni_type
54
}

app-dev/devops-and-containers/oke/oke-rm/infra/main.tf

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,11 @@ module "network" {
5353
cp_external_nat = var.cp_external_nat
5454
allow_external_cp_traffic = var.allow_external_cp_traffic
5555
cp_egress_cidr = var.cp_egress_cidr
56-
}
57-
58-
module "bastion" {
59-
source = "./modules/bastion"
60-
region = var.region
61-
compartment_id = var.bastion_compartment_id
62-
vcn_name = var.vcn_name
63-
bastion_subnet_id = module.network.bastion_subnet_id
64-
bastion_cidr_block_allow_list = var.bastion_cidr_block_allow_list
65-
count = local.create_bastion ? 1 : 0
56+
# DRG
57+
enable_drg = var.enable_drg
58+
create_drg = var.create_drg
59+
drg_id = var.drg_id
60+
drg_name = var.drg_name
61+
create_drg_attachment = var.create_drg_attachment
62+
peer_vcns = var.peer_vcns
6663
}

app-dev/devops-and-containers/oke/oke-rm/infra/modules/bastion/bastion.tf

Lines changed: 0 additions & 8 deletions
This file was deleted.

app-dev/devops-and-containers/oke/oke-rm/infra/modules/bastion/provider.tf

Lines changed: 0 additions & 8 deletions
This file was deleted.

app-dev/devops-and-containers/oke/oke-rm/infra/modules/bastion/variable.tf

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "oci_core_drg" "vcn_drg" {
2+
compartment_id = var.network_compartment_id
3+
display_name = var.drg_name
4+
5+
count = local.create_drg ? 1 : 0
6+
}
7+
8+
resource "oci_core_drg_attachment" "oke_drg_attachment" {
9+
drg_id = local.drg_id
10+
display_name = "${var.vcn_name}-attachment"
11+
12+
network_details {
13+
id = local.vcn_id
14+
type = "VCN"
15+
}
16+
17+
count = local.create_drg_attachment ? 1 : 0
18+
}
19+

app-dev/devops-and-containers/oke/oke-rm/infra/modules/network/local.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ locals {
1010
nat_gateway_id = var.create_gateways ? oci_core_nat_gateway.nat_gateway.0.id : var.nat_gateway_id
1111
cp_nat_mode = local.create_cp_subnet && var.cp_subnet_private && var.cp_external_nat
1212
create_cp_external_traffic_rule = var.allow_external_cp_traffic && (! var.create_cp_subnet || (! var.cp_subnet_private || var.cp_external_nat))
13+
create_drg = var.enable_drg && var.create_drg
14+
create_drg_attachment = var.enable_drg && var.create_drg_attachment
15+
drg_id = var.create_drg ? oci_core_drg.vcn_drg.0.id : var.drg_id
16+
1317

1418

1519
tcp_protocol = "6"

app-dev/devops-and-containers/oke/oke-rm/infra/modules/network/routing.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ resource "oci_core_route_table" "service_route_table" {
3333
destination = lookup(data.oci_core_services.all_oci_services.services[0], "cidr_block")
3434
description = "Route for all internal OCI services in the region"
3535
}
36+
37+
dynamic "route_rules" {
38+
for_each = var.enable_drg ? var.peer_vcns : []
39+
content {
40+
network_entity_id = local.drg_id
41+
destination_type = "CIDR_BLOCK"
42+
destination = route_rules.value
43+
description = "Route to ${route_rules.value} through the DRG"
44+
}
45+
}
46+
3647
}
3748

3849
resource "oci_core_route_table" "nat_route_table" {
@@ -51,6 +62,17 @@ resource "oci_core_route_table" "nat_route_table" {
5162
destination = "0.0.0.0/0"
5263
description = "Route to reach external Internet through a NAT gateway"
5364
}
65+
66+
dynamic "route_rules" {
67+
for_each = var.enable_drg ? var.peer_vcns : []
68+
content {
69+
network_entity_id = local.drg_id
70+
destination_type = "CIDR_BLOCK"
71+
destination = route_rules.value
72+
description = "Route to ${route_rules.value} through the DRG"
73+
}
74+
}
75+
5476
}
5577

5678
resource "oci_core_route_table" "internet_route_table" {

0 commit comments

Comments
 (0)