Skip to content

Commit b576712

Browse files
authored
feat: added support to optionally pass an existing CBR zone ID in which all VPCs created will be added to (#745)
1 parent 3b9d896 commit b576712

31 files changed

+146
-5
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Large diffs are not rendered by default.

cbr.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
##############################################################################
2+
# Update existing CBR VPC network zone
3+
##############################################################################
4+
module "update_cbr_vpc_zone" {
5+
source = "terraform-ibm-modules/cbr/ibm//modules/cbr-zone-module"
6+
version = "1.26.0"
7+
count = var.existing_vpc_cbr_zone_id != null ? 1 : 0
8+
use_existing_cbr_zone = true
9+
existing_zone_id = var.existing_vpc_cbr_zone_id
10+
addresses = [
11+
for network in module.vpc :
12+
{ "type" = "vpc",
13+
value = network.vpc_crn }
14+
]
15+
}

examples/one-vpc-one-vsi/override.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"transit_gateway_global": false,
44
"virtual_private_endpoints": [],
55
"service_endpoints": "public-and-private",
6+
"existing_vpc_cbr_zone_id" : null,
67
"security_groups": [],
78
"vpn_gateways": [],
89
"atracker": {

examples/override-example/override.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
}
7878
],
7979
"service_endpoints": "public-and-private",
80+
"existing_vpc_cbr_zone_id" : null,
8081
"security_groups": [],
8182
"vpn_gateways": [
8283
{

ibm_catalog.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
{
4444
"description": "Provisions and manages SSH keys for the VSIs so that you can securely administer the instances.\n",
4545
"title": "Provisions SSH keys"
46+
},
47+
{
48+
"description": "Configures existing CBR (Context-based restrictions) rules to allow traffic to flow only from the landing zone VPCs to specific cloud services.\n",
49+
"title": "Configures CBR"
4650
}
4751
],
4852
"flavors": [
@@ -475,6 +479,10 @@
475479
{
476480
"title": "Uses floating IP addresses for access through the public internet",
477481
"description": "No"
482+
},
483+
{
484+
"description": "Configures existing CBR (Context-based restrictions) rules to allow traffic to flow only from the landing zone VPCs to specific cloud services.\n",
485+
"title": "Configures CBR"
478486
}
479487
],
480488
"diagrams": [
@@ -927,6 +935,10 @@
927935
{
928936
"title": "Uses Floating IP address for access through the public internet",
929937
"description": "No"
938+
},
939+
{
940+
"description": "Configures existing CBR (Context-based restrictions) rules to allow traffic to flow only from the landing zone VPCs to specific cloud services.\n",
941+
"title": "Configures CBR"
930942
}
931943
],
932944
"diagrams": [
@@ -1435,6 +1447,10 @@
14351447
{
14361448
"title": "Uses Floating IP address for access through the public internet",
14371449
"description": "No"
1450+
},
1451+
{
1452+
"description": "Configures existing CBR (Context-based restrictions) rules to allow traffic to flow only from the landing zone VPCs to specific cloud services.\n",
1453+
"title": "Configures CBR"
14381454
}
14391455
],
14401456
"diagrams": [

patterns/mixed/config.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ locals {
257257
virtual_private_endpoints = lookup(local.override[local.override_type], "virtual_private_endpoints", local.config.virtual_private_endpoints)
258258
cos = lookup(local.override[local.override_type], "cos", local.config.object_storage)
259259
service_endpoints = lookup(local.override[local.override_type], "service_endpoints", var.service_endpoints)
260+
existing_vpc_cbr_zone_id = lookup(local.override[local.override_type], "existing_vpc_cbr_zone_id", var.existing_vpc_cbr_zone_id)
260261
skip_kms_block_storage_s2s_auth_policy = lookup(local.override[local.override_type], "skip_kms_block_storage_s2s_auth_policy", local.config.skip_kms_block_storage_s2s_auth_policy)
261262
skip_all_s2s_auth_policies = lookup(local.override[local.override_type], "skip_all_s2s_auth_policies", local.config.skip_all_s2s_auth_policies)
262263
key_management = lookup(local.override[local.override_type], "key_management", local.config.key_management)

patterns/mixed/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module "landing_zone" {
3434
virtual_private_endpoints = local.env.virtual_private_endpoints
3535
cos = local.env.cos
3636
service_endpoints = local.env.service_endpoints
37+
existing_vpc_cbr_zone_id = local.env.existing_vpc_cbr_zone_id
3738
key_management = local.env.key_management
3839
skip_kms_block_storage_s2s_auth_policy = local.env.skip_kms_block_storage_s2s_auth_policy
3940
skip_all_s2s_auth_policies = local.env.skip_all_s2s_auth_policies

patterns/mixed/override.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
"resource_group": "slz-service-rg",
163163
"use_hs_crypto": false,
164164
"service_endpoints": "public-and-private"
165+
165166
},
166167
"resource_groups": [
167168
{
@@ -179,6 +180,7 @@
179180
],
180181
"security_groups": [],
181182
"service_endpoints": "public-and-private",
183+
"existing_vpc_cbr_zone_id" : null,
182184
"ssh_keys": [
183185
{
184186
"name": "slz-ssh-key",

patterns/mixed/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,3 +592,15 @@ variable "IC_SCHEMATICS_WORKSPACE_ID" {
592592
}
593593

594594
##############################################################################
595+
596+
597+
##############################################################################
598+
# CBR variables
599+
##############################################################################
600+
variable "existing_vpc_cbr_zone_id" {
601+
type = string
602+
description = "ID of the existing CBR (Context-based restrictions) network zone, with context set to the VPC. This zone is used in a CBR rule, which allows traffic to flow only from the landing zone VPCs to specific cloud services."
603+
default = null
604+
}
605+
606+
##############################################################################

patterns/roks/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ module "roks_landing_zone" {
105105
teleport_management_zones = var.teleport_management_zones
106106
IC_SCHEMATICS_WORKSPACE_ID = var.IC_SCHEMATICS_WORKSPACE_ID
107107
kms_wait_for_apply = var.kms_wait_for_apply
108+
existing_vpc_cbr_zone_id = var.existing_vpc_cbr_zone_id
108109
}
109110

110111
moved {

0 commit comments

Comments
 (0)