Skip to content

Commit 99ad28e

Browse files
authored
feat: add support for [Virtual Network Interface](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about) in all VSI patterns.<br>- The VSI patterns will now creates VSIs using the next gen virtual network interface by default, these VNIs are created independent of the VSIs. (#915)
1 parent 7fe4b2a commit 99ad28e

File tree

13 files changed

+107
-65
lines changed

13 files changed

+107
-65
lines changed

README.md

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

bastion_host.tf

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@ module "teleport_config" {
4141
##############################################################################
4242

4343
module "bastion_host" {
44-
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
45-
version = "4.2.0"
46-
for_each = local.bastion_vsi_map
47-
resource_group_id = each.value.resource_group == null ? null : local.resource_groups[each.value.resource_group]
48-
create_security_group = each.value.security_group == null ? false : true
49-
prefix = "${var.prefix}-${each.value.name}"
50-
vpc_id = module.vpc[each.value.vpc_name].vpc_id
51-
subnets = each.value.subnets
52-
access_tags = each.value.access_tags
53-
kms_encryption_enabled = true
54-
skip_iam_authorization_policy = true
55-
vsi_per_subnet = 1
44+
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
45+
version = "4.3.0"
46+
for_each = local.bastion_vsi_map
47+
resource_group_id = each.value.resource_group == null ? null : local.resource_groups[each.value.resource_group]
48+
create_security_group = each.value.security_group == null ? false : true
49+
prefix = "${var.prefix}-${each.value.name}"
50+
vpc_id = module.vpc[each.value.vpc_name].vpc_id
51+
subnets = each.value.subnets
52+
access_tags = each.value.access_tags
53+
kms_encryption_enabled = true
54+
skip_iam_authorization_policy = true
55+
vsi_per_subnet = 1
56+
primary_vni_additional_ip_count = each.value.primary_vni_additional_ip_count
57+
use_legacy_network_interface = each.value.use_legacy_network_interface
5658
boot_volume_encryption_key = each.value.boot_volume_encryption_key_name == null ? "" : [
5759
for keys in module.key_management.keys :
5860
keys.crn if keys.name == each.value.boot_volume_encryption_key_name

examples/override-example/override.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@
420420
"vsi-zone-1"
421421
],
422422
"vpc_name": "management",
423-
"vsi_per_subnet": 1
423+
"vsi_per_subnet": 1,
424+
"use_legacy_network_interface": false
424425
},
425426
{
426427
"access_tags": [],
@@ -453,7 +454,8 @@
453454
"vsi-zone-1"
454455
],
455456
"vpc_name": "workload",
456-
"vsi_per_subnet": 1
457+
"vsi_per_subnet": 1,
458+
"use_legacy_network_interface": false
457459
},
458460
{
459461
"access_tags": [],
@@ -502,7 +504,8 @@
502504
"health_type": "tcp",
503505
"idle_connection_timeout": 50
504506
}
505-
]
507+
],
508+
"use_legacy_network_interface": false
506509
}
507510
],
508511
"wait_till": "IngressReady"

f5_vsi.tf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ locals {
117117

118118
module "f5_vsi" {
119119
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
120-
version = "4.2.0"
120+
version = "4.3.0"
121121
for_each = local.f5_vsi_map
122122
resource_group_id = each.value.resource_group == null ? null : local.resource_groups[each.value.resource_group]
123123
create_security_group = each.value.security_group == null ? false : true
@@ -136,12 +136,14 @@ module "f5_vsi" {
136136
interface_name = group.interface_name
137137
}
138138
]
139-
image_id = local.public_image_map[each.value.f5_image_name][var.region]
140-
user_data = module.dynamic_values.f5_template_map[each.key].user_data
141-
machine_type = each.value.machine_type
142-
vsi_per_subnet = 1
143-
security_group = each.value.security_group
144-
load_balancers = each.value.load_balancers == null ? [] : each.value.load_balancers
139+
image_id = local.public_image_map[each.value.f5_image_name][var.region]
140+
user_data = module.dynamic_values.f5_template_map[each.key].user_data
141+
machine_type = each.value.machine_type
142+
vsi_per_subnet = 1
143+
security_group = each.value.security_group
144+
primary_vni_additional_ip_count = each.value.primary_vni_additional_ip_count
145+
use_legacy_network_interface = each.value.use_legacy_network_interface
146+
load_balancers = each.value.load_balancers == null ? [] : each.value.load_balancers
145147
# Get boot volume
146148
boot_volume_encryption_key = each.value.boot_volume_encryption_key_name == null ? "" : [
147149
for keys in module.key_management.keys :

patterns/vsi-extension/main.tf

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,29 @@ locals {
3838
}
3939

4040
module "vsi" {
41-
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
42-
version = "4.2.0"
43-
resource_group_id = data.ibm_is_vpc.vpc_by_id.resource_group
44-
create_security_group = true
45-
prefix = "${var.prefix}-vsi"
46-
vpc_id = var.vpc_id
47-
subnets = var.subnet_names != null ? local.subnets : data.ibm_is_vpc.vpc_by_id.subnets
48-
tags = var.resource_tags
49-
access_tags = var.access_tags
50-
kms_encryption_enabled = true
51-
skip_iam_authorization_policy = true
52-
user_data = var.user_data
53-
image_id = data.ibm_is_image.image.id
54-
boot_volume_encryption_key = var.boot_volume_encryption_key
55-
security_group_ids = var.security_group_ids
56-
ssh_key_ids = [local.ssh_key_id]
57-
machine_type = var.vsi_instance_profile
58-
vsi_per_subnet = var.vsi_per_subnet
59-
security_group = local.env.security_groups[0]
60-
load_balancers = var.load_balancers
61-
block_storage_volumes = var.block_storage_volumes
62-
enable_floating_ip = var.enable_floating_ip
63-
placement_group_id = var.placement_group_id
41+
source = "terraform-ibm-modules/landing-zone-vsi/ibm"
42+
version = "4.3.0"
43+
resource_group_id = data.ibm_is_vpc.vpc_by_id.resource_group
44+
create_security_group = true
45+
prefix = "${var.prefix}-vsi"
46+
vpc_id = var.vpc_id
47+
subnets = var.subnet_names != null ? local.subnets : data.ibm_is_vpc.vpc_by_id.subnets
48+
tags = var.resource_tags
49+
access_tags = var.access_tags
50+
kms_encryption_enabled = true
51+
skip_iam_authorization_policy = true
52+
user_data = var.user_data
53+
image_id = data.ibm_is_image.image.id
54+
boot_volume_encryption_key = var.boot_volume_encryption_key
55+
security_group_ids = var.security_group_ids
56+
ssh_key_ids = [local.ssh_key_id]
57+
machine_type = var.vsi_instance_profile
58+
vsi_per_subnet = var.vsi_per_subnet
59+
security_group = local.env.security_groups[0]
60+
load_balancers = var.load_balancers
61+
block_storage_volumes = var.block_storage_volumes
62+
enable_floating_ip = var.enable_floating_ip
63+
placement_group_id = var.placement_group_id
64+
primary_vni_additional_ip_count = var.primary_vni_additional_ip_count
65+
use_legacy_network_interface = var.use_legacy_network_interface
6466
}

patterns/vsi-extension/variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,16 @@ variable "load_balancers" {
173173
)
174174
default = []
175175
}
176+
177+
variable "primary_vni_additional_ip_count" {
178+
description = "The number of secondary reversed IPs to attach to a Virtual Network Interface (VNI). Additional IPs are created only if `manage_reserved_ips` is set to true."
179+
type = number
180+
nullable = false
181+
default = 0
182+
}
183+
184+
variable "use_legacy_network_interface" {
185+
description = "Set this to true to use legacy network interface for the created instances."
186+
type = bool
187+
default = false
188+
}

patterns/vsi-quickstart/variables.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ variable "override_json_string" {
272272
],
273273
"vpc_name": "management",
274274
"vsi_per_subnet": 1,
275-
"enable_floating_ip": true
275+
"enable_floating_ip": true,
276+
"use_legacy_network_interface": false
276277
},
277278
{
278279
"boot_volume_encryption_key_name": "slz-vsi-volume-key",
@@ -308,7 +309,8 @@ variable "override_json_string" {
308309
],
309310
"vpc_name": "workload",
310311
"vsi_per_subnet": 1,
311-
"enable_floating_ip": false
312+
"enable_floating_ip": false,
313+
"use_legacy_network_interface": false
312314
}
313315
]
314316
}

patterns/vsi/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ module "vsi_landing_zone" {
8787
override_json_string = var.override_json_string
8888
override_json_path = local.override_json_path
8989
existing_vpc_cbr_zone_id = var.existing_vpc_cbr_zone_id
90+
use_legacy_network_interface = var.use_legacy_network_interface
9091
}
9192

9293
moved {

patterns/vsi/module/config.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ locals {
9494
vsi_per_subnet = var.vsi_per_subnet
9595
machine_type = var.vsi_instance_profile
9696
boot_volume_encryption_key_name = "${var.prefix}-vsi-volume-key"
97+
use_legacy_network_interface = var.use_legacy_network_interface
9798
security_group = {
9899
name = "${var.prefix}-${network}"
99100
vpc_name = var.vpcs[0]

patterns/vsi/module/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ variable "vsi_per_subnet" {
140140
default = 1
141141
}
142142

143+
variable "use_legacy_network_interface" {
144+
description = "Set this to true to use legacy network interface for the created instances."
145+
type = bool
146+
default = false
147+
}
148+
143149
##############################################################################
144150

145151

0 commit comments

Comments
 (0)