Skip to content

Commit

Permalink
Adding network_profile to the VPC modules
Browse files Browse the repository at this point in the history
  • Loading branch information
cdunbar13 committed Dec 11, 2024
1 parent 063530c commit d474219
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/network/multivpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ limitations under the License.
| <a name="input_network_description"></a> [network\_description](#input\_network\_description) | An optional description of this resource (changes will trigger resource destroy/create) | `string` | `""` | no |
| <a name="input_network_interface_defaults"></a> [network\_interface\_defaults](#input\_network\_interface\_defaults) | The template of the network settings to be used on all vpcs. | <pre>object({<br/> network = optional(string)<br/> subnetwork = optional(string)<br/> subnetwork_project = optional(string)<br/> network_ip = optional(string, "")<br/> nic_type = optional(string, "GVNIC")<br/> stack_type = optional(string, "IPV4_ONLY")<br/> queue_count = optional(string)<br/> access_config = optional(list(object({<br/> nat_ip = string<br/> network_tier = string<br/> public_ptr_domain_name = string<br/> })), [])<br/> ipv6_access_config = optional(list(object({<br/> network_tier = string<br/> public_ptr_domain_name = string<br/> })), [])<br/> alias_ip_range = optional(list(object({<br/> ip_cidr_range = string<br/> subnetwork_range_name = string<br/> })), [])<br/> })</pre> | <pre>{<br/> "access_config": [],<br/> "alias_ip_range": [],<br/> "ipv6_access_config": [],<br/> "network": null,<br/> "network_ip": "",<br/> "nic_type": "GVNIC",<br/> "queue_count": null,<br/> "stack_type": "IPV4_ONLY",<br/> "subnetwork": null,<br/> "subnetwork_project": null<br/>}</pre> | no |
| <a name="input_network_name_prefix"></a> [network\_name\_prefix](#input\_network\_name\_prefix) | The base name of the vpcs and their subnets, will be appended with a sequence number | `string` | `""` | no |
| <a name="input_network_profile"></a> [network\_profile](#input\_network\_profile) | A full or partial URL of the network profile to apply to this network.<br/>This field can be set only at resource creation time. For example, the<br/>following are valid URLs:<br/>- https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name}<br/>- projects/{projectId}/global/networkProfiles/{network\_profile\_name}} | `string` | `null` | no |
| <a name="input_network_routing_mode"></a> [network\_routing\_mode](#input\_network\_routing\_mode) | The network dynamic routing mode | `string` | `"REGIONAL"` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | The default region for Cloud resources | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions modules/network/multivpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ module "vpcs" {
mtu = var.mtu
network_description = var.network_description
network_routing_mode = var.network_routing_mode
network_profile = var.network_profile
}
12 changes: 12 additions & 0 deletions modules/network/multivpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,15 @@ variable "network_interface_defaults" {
alias_ip_range = []
}
}

variable "network_profile" {
type = string
description = <<-EOT
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}}
EOT
default = null
}
3 changes: 2 additions & 1 deletion modules/network/vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ No providers.
|------|--------|---------|
| <a name="module_cloud_router"></a> [cloud\_router](#module\_cloud\_router) | terraform-google-modules/cloud-router/google | ~> 6.0 |
| <a name="module_nat_ip_addresses"></a> [nat\_ip\_addresses](#module\_nat\_ip\_addresses) | terraform-google-modules/address/google | ~> 4.1 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-google-modules/network/google | ~> 9.0 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-google-modules/network/google | ~> 10.0 |

## Resources

Expand Down Expand Up @@ -201,6 +201,7 @@ No resources.
| <a name="input_network_address_range"></a> [network\_address\_range](#input\_network\_address\_range) | IP address range (CIDR) for global network | `string` | `"10.0.0.0/9"` | no |
| <a name="input_network_description"></a> [network\_description](#input\_network\_description) | An optional description of this resource (changes will trigger resource destroy/create) | `string` | `""` | no |
| <a name="input_network_name"></a> [network\_name](#input\_network\_name) | The name of the network to be created (if unsupplied, will default to "{deployment\_name}-net") | `string` | `null` | no |
| <a name="input_network_profile"></a> [network\_profile](#input\_network\_profile) | A full or partial URL of the network profile to apply to this network.<br/>This field can be set only at resource creation time. For example, the<br/>following are valid URLs:<br/>- https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name}<br/>- projects/{projectId}/global/networkProfiles/{network\_profile\_name}} | `string` | `null` | no |
| <a name="input_network_routing_mode"></a> [network\_routing\_mode](#input\_network\_routing\_mode) | The network routing mode (default "GLOBAL") | `string` | `"GLOBAL"` | no |
| <a name="input_primary_subnetwork"></a> [primary\_subnetwork](#input\_primary\_subnetwork) | DEPRECATED: please see https://goo.gle/hpc-toolkit-vpc-deprecation for migration instructions | `map(string)` | `null` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created | `string` | n/a | yes |
Expand Down
3 changes: 2 additions & 1 deletion modules/network/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ locals {

module "vpc" {
source = "terraform-google-modules/network/google"
version = "~> 9.0"
version = "~> 10.0"

network_name = local.network_name
project_id = var.project_id
Expand All @@ -169,6 +169,7 @@ module "vpc" {
shared_vpc_host = var.shared_vpc_host
delete_default_internet_gateway_routes = var.delete_default_internet_gateway_routes
firewall_rules = local.firewall_rules
network_profile = var.network_profile
}

# This use of the module may appear odd when var.ips_per_nat = 0. The module
Expand Down
12 changes: 12 additions & 0 deletions modules/network/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,15 @@ variable "firewall_log_config" {
error_message = "var.firewall_log_config must be set to \"DISABLE_LOGGING\", or enable logging with \"INCLUDE_ALL_METADATA\" or \"EXCLUDE_ALL_METADATA\""
}
}

variable "network_profile" {
type = string
description = <<-EOT
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}}
EOT
default = null
}

0 comments on commit d474219

Please sign in to comment.