README.md
June 10, 2026 ยท View on GitHub
Description
This module accomplishes the following:
- Creates 1 to 8 VPC networks
- Each VPC contains exactly 1 subnetwork
- Each subnetwork contains distinct IP address ranges
- Outputs the
additional_networksparameter, which is compatible with Slurm modules
There are 4 variables that differentiate this module from the standard VPC module.
network_prefix: The name prefix of the VPCs to be created. All networks and subnetworks will start with this and end with a unique number.network_count: The number of VPCs to be created.global_ip_address_range: CIDR-formatted IP rangenetwork_cidr_suffix: The CIDR suffix that defines the address space that the individual VPCs will cover.
Warning
The network_cidr_suffix should be always be larger than the CIDR suffix on
global_ip_address_range. The difference between these two suffixes should
be large enough to accommodate the number of VPCs that are being deployed
(e.g. CIDR suffix bit difference <= ceil(log2(network_count)))).
Note
For deployments that need multiple VPCs that do not meet this use-case, users should deploy multiple individual VPC modules.
Example
This snippet uses the multivpc module to create 8 new VPC networks named
multivpc-net-# where # ranges from 0 to 7. Additionally, it creates 1
subnetwork in each VPC.
- id: network
source: modules/network/vpc
- id: multinetwork
source: modules/network/multivpc
settings:
network_name_prefix: multivpc-net
network_count: 8
global_ip_address_range: 172.16.0.0/12
subnetwork_cidr_suffix: 16
- id: a3_nodeset
source: community/modules/compute/schedmd-slurm-gcp-v6-nodeset
use: [network, multinetwork]
settings:
machine_type: a3-highgpu-8g
...
Copyright 2026 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Requirements
| Name | Version |
|---|---|
| terraform | >= 1.12.2 |
Providers
| Name | Version |
|---|---|
| terraform | n/a |
Modules
| Name | Source | Version |
|---|---|---|
| vpcs | ../vpc | n/a |
Resources
| Name | Type |
|---|---|
| terraform_data.global_ip_cidr_suffix | resource |
Inputs
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| allowed_ssh_ip_ranges | A list of CIDR IP ranges from which to allow ssh access | list(string) | [] | no |
| delete_default_internet_gateway_routes | If set, ensure that all routes within the network specified whose names begin with 'default-route' and with a next hop of 'default-internet-gateway' are deleted | bool | false | no |
| deployment_name | The name of the current deployment | string | n/a | yes |
| enable_cloud_nat | Enable the creation of Cloud NATs. | bool | true | no |
| enable_cloud_router | Enable the creation of a Cloud Router for your VPC. For more information on Cloud Routers see https://cloud.google.com/network-connectivity/docs/router/concepts/overview | bool | true | no |
| enable_iap_rdp_ingress | Enable a firewall rule to allow Windows Remote Desktop Protocol access using IAP tunnels | bool | false | no |
| enable_iap_ssh_ingress | Enable a firewall rule to allow SSH access using IAP tunnels | bool | true | no |
| enable_iap_winrm_ingress | Enable a firewall rule to allow Windows Remote Management (WinRM) access using IAP tunnels | bool | false | no |
| enable_internal_traffic | Enable a firewall rule to allow all internal TCP, UDP, and ICMP traffic within the network | bool | true | no |
| extra_iap_ports | A list of TCP ports for which to create firewall rules that enable IAP for TCP forwarding (use dedicated enable_iap variables for standard ports) | list(string) | [] | no |
| firewall_rules | List of firewall rules | any | [] | no |
| global_ip_address_range | IP address range (CIDR) that will span entire set of VPC networks | string | "172.16.0.0/12" | no |
| ips_per_nat | The number of IP addresses to allocate for each regional Cloud NAT (set to 0 to disable NAT) | number | 2 | no |
| mtu | The network MTU (default: 8896). Recommended values: 0 (use Compute Engine default), 1460 (default outside HPC environments), 1500 (Internet default), or 8896 (for Jumbo packets). Allowed are all values in the range 1300 to 8896, inclusively. | number | 8896 | no |
| network_count | The number of vpc nettworks to create | number | 4 | no |
| network_description | An optional description of this resource (changes will trigger resource destroy/create) | string | "" | no |
| network_interface_defaults | The template of the network settings to be used on all vpcs. | object({ | { | no |
| network_name_prefix | The base name of the vpcs and their subnets, will be appended with a sequence number | string | "" | no |
| network_profile | A full or partial URL of the network profile to apply to this network. This field can be set only at resource creation time. For example, the following are valid URLs: - https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name} - projects/{projectId}/global/networkProfiles/{network_profile_name}} When using a Mellanox network profile (contains 'roce'), if firewall_rules is specified or enable_internal_traffic is true, an error will be thrown | string | null | no |
| network_routing_mode | The network dynamic routing mode | string | "REGIONAL" | no |
| project_id | Project in which the HPC deployment will be created | string | n/a | yes |
| region | The default region for Cloud resources | string | n/a | yes |
| subnetwork_cidr_suffix | The size, in CIDR suffix notation, for each network (e.g. 24 for 172.16.0.0/24); changing this will destroy every network. | number | 16 | no |
| subnetwork_private_access | Enable Private Google Access on the subnetworks | bool | true | no |
Outputs
| Name | Description |
|---|---|
| additional_networks | Network interfaces for each subnetwork created by this module |
| network_ids | IDs of the new VPC network |
| network_names | Names of the new VPC networks |
| network_self_links | Self link of the new VPC network |
| subnetwork_addresses | IP address range of the primary subnetwork |
| subnetwork_names | Names of the subnetwork created in each network |
| subnetwork_self_links | Self link of the primary subnetwork |