Skip to content

Commit b67fbf0

Browse files
committed
Adding support changes for NPI
1 parent 2026b2b commit b67fbf0

5 files changed

Lines changed: 38 additions & 12 deletions

File tree

modules/compute/vm-instance/variables.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ variable "network_interfaces" {
195195
subnetwork (string, required if network is not supplied)
196196
subnetwork_project (string, optional)
197197
network_ip (string, optional)
198-
nic_type (string, optional, choose from ["GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"])
199-
stack_type (string, optional, choose from ["IPV4_ONLY", "IPV4_IPV6"])
198+
nic_type (string, optional, choose from ["GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA","IDPF"])
199+
stack_type (string, optional, choose from ["IPV4_ONLY", "IPV4_IPV6" , "IPV6_ONLY"])
200200
queue_count (number, optional)
201201
access_config (object, optional)
202202
ipv6_access_config (object, optional)
@@ -233,15 +233,15 @@ variable "network_interfaces" {
233233
}
234234
validation {
235235
condition = alltrue([
236-
for ni in var.network_interfaces : ni.nic_type == "GVNIC" || ni.nic_type == "VIRTIO_NET" || ni.nic_type == "MRDMA" || ni.nic_type == "IRDMA" || ni.nic_type == null
236+
for ni in var.network_interfaces : ni.nic_type == "GVNIC" || ni.nic_type == "VIRTIO_NET" || ni.nic_type == "MRDMA" || ni.nic_type == "IRDMA" || ni.nic_type == "IDPF" || ni.nic_type == null
237237
])
238-
error_message = "In the variable network_interfaces, field \"nic_type\" must be \"GVNIC\", \"VIRTIO_NET\", \"MRDMA\", \"IRDMA\", or null."
238+
error_message = "In the variable network_interfaces, field \"nic_type\" must be \"GVNIC\", \"VIRTIO_NET\", \"MRDMA\", \"IRDMA\",\"IDPF\" or null."
239239
}
240240
validation {
241241
condition = alltrue([
242-
for ni in var.network_interfaces : ni.stack_type == "IPV4_ONLY" || ni.stack_type == "IPV4_IPV6" || ni.stack_type == null
242+
for ni in var.network_interfaces : ni.stack_type == "IPV4_ONLY" || ni.stack_type == "IPV4_IPV6" || ni.stack_type == "IPV6_ONLY" || ni.stack_type == null
243243
])
244-
error_message = "In the variable network_interfaces, field \"stack_type\" must be either \"IPV4_ONLY\", \"IPV4_IPV6\" or null."
244+
error_message = "In the variable network_interfaces, field \"stack_type\" must be either \"IPV4_ONLY\", \"IPV4_IPV6\" , \"IPV6_ONLY\" or null."
245245
}
246246
}
247247

modules/network/gpu-rdma-vpc/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ locals {
1818
autoname = replace(var.deployment_name, "_", "-")
1919
network_name = var.network_name == null ? "${local.autoname}-net" : var.network_name
2020
subnet_prefix = var.subnetworks_template.name_prefix == null ? "${local.autoname}-subnet" : var.subnetworks_template.name_prefix
21-
22-
new_bits = ceil(log(var.subnetworks_template.count, 2))
23-
template_subnetworks = [for i in range(var.subnetworks_template.count) :
21+
is_roce_metal = var.network_profile != null ? can(regex("vpc-roce-metal", var.network_profile)) : false
22+
23+
new_bits = local.is_roce_metal? 0 : ceil(log(var.subnetworks_template.count, 2))
24+
template_subnetworks = local.is_roce_metal? [] : [for i in range(var.subnetworks_template.count) :
2425
{
2526
subnet_name = "${local.subnet_prefix}-${i}"
2627
subnet_region = try(var.subnetworks_template.region, var.region)

modules/network/gpu-rdma-vpc/variables.tf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ variable "subnetworks_template" {
5050
ip_range (string, required, range of IPs for all subnets to share (CIDR format), default is 192.168.0.0/16)
5151
region (string, optional, region to deploy subnets to, defaults to vars.region)
5252
EOT
53-
nullable = false
53+
nullable = true
5454
type = object({
5555
count = number
5656
name_prefix = string
@@ -65,8 +65,18 @@ variable "subnetworks_template" {
6565
}
6666

6767
validation {
68-
condition = var.subnetworks_template.count > 0
69-
error_message = "Number of subnetworks must be greater than 0"
68+
# If it's NOT a RoCE Metal profile, the template cannot be null
69+
condition = (
70+
can(regex("vpc-roce-metal", var.network_profile)) ||
71+
var.subnetworks_template != null
72+
)
73+
error_message = "subnetworks_template cannot be null unless using a 'vpc-roce-metal' network profile."
74+
}
75+
76+
validation {
77+
# If template is provided, count must be > 0
78+
condition = var.subnetworks_template == null ? true : var.subnetworks_template.count > 0
79+
error_message = "Number of subnetworks must be greater than 0."
7080
}
7181

7282
validation {

modules/network/vpc/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ module "vpc" {
191191
secondary_ranges = length(local.secondary_ranges_map) > 0 ? local.secondary_ranges_map : var.secondary_ranges
192192
routing_mode = var.network_routing_mode
193193
mtu = var.mtu
194+
enable_ipv6_ula = var.enable_ipv6_ula
195+
internal_ipv6_range = var.internal_ipv6_range
194196
description = var.network_description
195197
shared_vpc_host = var.shared_vpc_host
196198
delete_default_internet_gateway_routes = var.delete_default_internet_gateway_routes

modules/network/vpc/variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ variable "mtu" {
8282
default = 8896
8383
}
8484

85+
variable "enable_ipv6_ula" {
86+
description = "Enabled IPv6 ULA, this is a permanent change and cannot be undone!"
87+
type = bool
88+
default = false
89+
}
90+
91+
variable "internal_ipv6_range" {
92+
description = "When enabling IPv6 ULA, optionally specify a /48 from fd20::/20 (default null)"
93+
type = string
94+
default = null
95+
}
96+
97+
8598
variable "subnetworks" {
8699
description = <<-EOT
87100
List of subnetworks to create within the VPC. If left empty, it will be

0 commit comments

Comments
 (0)