Skip to content

Commit 9efe1b7

Browse files
committed
Add IPv6 and IDPF support and fix RoCE metal subnetwork logic
1 parent b67fbf0 commit 9efe1b7

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

modules/compute/vm-instance/variables.tf

Lines changed: 4 additions & 4 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","IDPF"])
199-
stack_type (string, optional, choose from ["IPV4_ONLY", "IPV4_IPV6" , "IPV6_ONLY"])
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,13 +233,13 @@ 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 == "IDPF" || ni.nic_type == null
236+
for ni in var.network_interfaces : contains(["GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA", "IDPF", null], ni.nic_type)
237237
])
238238
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 == "IPV6_ONLY" || ni.stack_type == null
242+
for ni in var.network_interfaces : contains(["IPV4_ONLY", "IPV4_IPV6", "IPV6_ONLY", null], ni.stack_type)
243243
])
244244
error_message = "In the variable network_interfaces, field \"stack_type\" must be either \"IPV4_ONLY\", \"IPV4_IPV6\" , \"IPV6_ONLY\" or null."
245245
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
locals {
1818
autoname = replace(var.deployment_name, "_", "-")
1919
network_name = var.network_name == null ? "${local.autoname}-net" : var.network_name
20-
subnet_prefix = var.subnetworks_template.name_prefix == null ? "${local.autoname}-subnet" : var.subnetworks_template.name_prefix
20+
subnet_prefix = try(var.subnetworks_template.name_prefix, null) == null ? "${local.autoname}-subnet" : var.subnetworks_template.name_prefix
2121
is_roce_metal = var.network_profile != null ? can(regex("vpc-roce-metal", var.network_profile)) : false
2222

2323
new_bits = local.is_roce_metal? 0 : ceil(log(var.subnetworks_template.count, 2))
24+
// RoCE metal profile doesn't allow creating a subnetwork, as the profile
25+
// automatically creates a predefined subnetwork for the MRDMA interfaces.
26+
// See: https://cloud.google.com/vpc/docs/network-profiles
2427
template_subnetworks = local.is_roce_metal? [] : [for i in range(var.subnetworks_template.count) :
2528
{
2629
subnet_name = "${local.subnet_prefix}-${i}"

modules/network/vpc/variables.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ variable "mtu" {
8383
}
8484

8585
variable "enable_ipv6_ula" {
86-
description = "Enabled IPv6 ULA, this is a permanent change and cannot be undone!"
86+
description = "Enable IPv6 ULA, this is a permanent change and cannot be undone!"
8787
type = bool
8888
default = false
8989
}
@@ -94,7 +94,6 @@ variable "internal_ipv6_range" {
9494
default = null
9595
}
9696

97-
9897
variable "subnetworks" {
9998
description = <<-EOT
10099
List of subnetworks to create within the VPC. If left empty, it will be

0 commit comments

Comments
 (0)