diff --git a/modules/compute_instance/README.md b/modules/compute_instance/README.md index 750d3e7d..6980aa04 100644 --- a/modules/compute_instance/README.md +++ b/modules/compute_instance/README.md @@ -22,6 +22,7 @@ See the [simple](https://github.com/terraform-google-modules/terraform-google-vm | hostname | Hostname of instances | `string` | `""` | no | | hostname\_suffix\_separator | Separator character to compose hostname when add\_hostname\_suffix is set to true. | `string` | `"-"` | no | | instance\_template | Instance template self\_link used to create compute instances | `any` | n/a | yes | +| ipv6\_access\_config | IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. |
list(object({| `[]` | no | | network | Network to deploy to. Only one of network or subnetwork should be specified. | `string` | `""` | no | | num\_instances | Number of instances to create. This value is ignored if static\_ips is provided. | `string` | `"1"` | no | | region | Region where the instances should be created. | `string` | `null` | no | diff --git a/modules/compute_instance/main.tf b/modules/compute_instance/main.tf index 17331dbe..baf28587 100644 --- a/modules/compute_instance/main.tf +++ b/modules/compute_instance/main.tf @@ -68,6 +68,13 @@ resource "google_compute_instance_from_template" "compute_instance" { } } + dynamic "ipv6_access_config" { + for_each = var.ipv6_access_config + content { + network_tier = ipv6_access_config.value.network_tier + } + } + dynamic "alias_ip_range" { for_each = var.alias_ip_ranges content { diff --git a/modules/compute_instance/variables.tf b/modules/compute_instance/variables.tf index e9816fa6..dfd94c27 100644 --- a/modules/compute_instance/variables.tf +++ b/modules/compute_instance/variables.tf @@ -54,6 +54,14 @@ variable "access_config" { default = [] } +variable "ipv6_access_config" { + description = "IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access." + type = list(object({ + network_tier = string + })) + default = [] +} + variable "num_instances" { description = "Number of instances to create. This value is ignored if static_ips is provided." default = "1" diff --git a/modules/compute_instance/versions.tf b/modules/compute_instance/versions.tf index dfa0d217..be5e2ae9 100644 --- a/modules/compute_instance/versions.tf +++ b/modules/compute_instance/versions.tf @@ -17,7 +17,7 @@ terraform { required_version = ">=0.13.0" required_providers { - google = ">= 3.71, < 5.0" + google = ">= 3.88, < 5.0" } provider_meta "google" { module_name = "blueprints/terraform/terraform-google-vm:compute_instance/v7.9.0" diff --git a/modules/instance_template/README.md b/modules/instance_template/README.md index 906cab61..bb3a6456 100644 --- a/modules/instance_template/README.md +++ b/modules/instance_template/README.md @@ -15,7 +15,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example. |------|-------------|------|---------|:--------:| | access\_config | Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. |
network_tier = string
}))
list(object({| `[]` | no | | additional\_disks | List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name |
nat_ip = string
network_tier = string
}))
list(object({| `[]` | no | -| additional\_networks | Additional network interface details for GCE, if any. |
disk_name = string
device_name = string
auto_delete = bool
boot = bool
disk_size_gb = number
disk_type = string
disk_labels = map(string)
}))
list(object({| `[]` | no | +| additional\_networks | Additional network interface details for GCE, if any. |
network = string
subnetwork = string
subnetwork_project = string
network_ip = string
access_config = list(object({
nat_ip = string
network_tier = string
}))
}))
list(object({| `[]` | no | | alias\_ip\_range | An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks.
network = string
subnetwork = string
subnetwork_project = string
network_ip = string
access_config = list(object({
nat_ip = string
network_tier = string
}))
ipv6_access_config = list(object({
network_tier = string
}))
}))
object({| `null` | no | | auto\_delete | Whether or not the boot disk should be auto-deleted | `string` | `"true"` | no | | automatic\_restart | (Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). | `bool` | `true` | no | @@ -28,6 +28,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example. | enable\_nested\_virtualization | Defines whether the instance should have nested virtualization enabled. | `bool` | `false` | no | | enable\_shielded\_vm | Whether to enable the Shielded VM configuration on the instance. Note that the instance image must support Shielded VMs. See https://cloud.google.com/compute/docs/images | `bool` | `false` | no | | gpu | GPU information. Type and count of GPU to attach to the instance template. See https://cloud.google.com/compute/docs/gpus more details |
ip_cidr_range = string
subnetwork_range_name = string
})
object({| `null` | no | +| ipv6\_access\_config | IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. |
type = string
count = number
})
list(object({| `[]` | no | | labels | Labels, provided as a map | `map(string)` | `{}` | no | | machine\_type | Machine type to create, e.g. n1-standard-1 | `string` | `"n1-standard-1"` | no | | metadata | Metadata, provided as a map | `map(string)` | `{}` | no | diff --git a/modules/instance_template/main.tf b/modules/instance_template/main.tf index 65d0ce41..02b9c542 100644 --- a/modules/instance_template/main.tf +++ b/modules/instance_template/main.tf @@ -116,6 +116,12 @@ resource "google_compute_instance_template" "tpl" { network_tier = access_config.value.network_tier } } + dynamic "ipv6_access_config" { + for_each = var.ipv6_access_config + content { + network_tier = ipv6_access_config.value.network_tier + } + } dynamic "alias_ip_range" { for_each = local.alias_ip_range_enabled ? [var.alias_ip_range] : [] content { @@ -139,6 +145,12 @@ resource "google_compute_instance_template" "tpl" { network_tier = access_config.value.network_tier } } + dynamic "ipv6_access_config" { + for_each = network_interface.value.ipv6_access_config + content { + network_tier = ipv6_access_config.value.network_tier + } + } } } diff --git a/modules/instance_template/variables.tf b/modules/instance_template/variables.tf index 44007d65..314a48c5 100644 --- a/modules/instance_template/variables.tf +++ b/modules/instance_template/variables.tf @@ -187,6 +187,9 @@ variable "additional_networks" { nat_ip = string network_tier = string })) + ipv6_access_config = list(object({ + network_tier = string + })) })) } @@ -260,6 +263,14 @@ variable "access_config" { default = [] } +variable "ipv6_access_config" { + description = "IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access." + type = list(object({ + network_tier = string + })) + default = [] +} + ########################### # Guest Accelerator (GPU) ########################### diff --git a/modules/preemptible_and_regular_instance_templates/README.md b/modules/preemptible_and_regular_instance_templates/README.md index 3b0403aa..e6d6d96b 100644 --- a/modules/preemptible_and_regular_instance_templates/README.md +++ b/modules/preemptible_and_regular_instance_templates/README.md @@ -18,6 +18,7 @@ See the [simple](../../examples/preemptible_and_regular_instance_templates/simpl | can\_ip\_forward | Enable IP forwarding, for NAT instances for example | `string` | `"false"` | no | | disk\_size\_gb | Boot disk size in GB | `string` | `"100"` | no | | disk\_type | Boot disk type, can be either pd-ssd, local-ssd, or pd-standard | `string` | `"pd-standard"` | no | +| ipv6\_access\_config | IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. |
network_tier = string
}))
list(object({| `[]` | no | | labels | Labels, provided as a map | `map(string)` | `{}` | no | | machine\_type | Machine type to create, e.g. n1-standard-1 | `string` | `"n1-standard-1"` | no | | metadata | Metadata, provided as a map | `map(string)` | `{}` | no | diff --git a/modules/preemptible_and_regular_instance_templates/main.tf b/modules/preemptible_and_regular_instance_templates/main.tf index 72ac569e..523ab69b 100644 --- a/modules/preemptible_and_regular_instance_templates/main.tf +++ b/modules/preemptible_and_regular_instance_templates/main.tf @@ -40,6 +40,7 @@ module "preemptible" { subnetwork = var.subnetwork subnetwork_project = var.subnetwork_project access_config = var.access_config + ipv6_access_config = var.ipv6_access_config preemptible = true } @@ -65,5 +66,6 @@ module "regular" { subnetwork = var.subnetwork subnetwork_project = var.subnetwork_project access_config = var.access_config + ipv6_access_config = var.ipv6_access_config preemptible = false } diff --git a/modules/preemptible_and_regular_instance_templates/variables.tf b/modules/preemptible_and_regular_instance_templates/variables.tf index ef5cbd55..adf086b4 100644 --- a/modules/preemptible_and_regular_instance_templates/variables.tf +++ b/modules/preemptible_and_regular_instance_templates/variables.tf @@ -150,3 +150,11 @@ variable "access_config" { })) default = [] } + +variable "ipv6_access_config" { + description = "IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access." + type = list(object({ + network_tier = string + })) + default = [] +} diff --git a/modules/preemptible_and_regular_instance_templates/versions.tf b/modules/preemptible_and_regular_instance_templates/versions.tf index 2d3d7df4..dd4d6ccc 100644 --- a/modules/preemptible_and_regular_instance_templates/versions.tf +++ b/modules/preemptible_and_regular_instance_templates/versions.tf @@ -17,8 +17,8 @@ terraform { required_version = ">=0.13.0" required_providers { - google = ">= 3.71, < 5.0" - google-beta = ">= 3.71, < 5.0" + google = ">= 3.88, < 5.0" + google-beta = ">= 3.88, < 5.0" } provider_meta "google" { module_name = "blueprints/terraform/terraform-google-vm:preemptible_and_regular_instance_templates/v7.9.0" diff --git a/modules/umig/README.md b/modules/umig/README.md index efdd3df1..cc7afd68 100644 --- a/modules/umig/README.md +++ b/modules/umig/README.md @@ -16,10 +16,11 @@ See the [simple](https://github.com/terraform-google-modules/terraform-google-vm | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_config | Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. |
network_tier = string
}))
list(list(object({| `[]` | no | -| additional\_networks | Additional network interface details for GCE, if any. |
nat_ip = string
network_tier = string
})))
list(object({| `[]` | no | +| additional\_networks | Additional network interface details for GCE, if any. |
network = string
subnetwork = string
subnetwork_project = string
network_ip = string
access_config = list(object({
nat_ip = string
network_tier = string
}))
}))
list(object({| `[]` | no | | hostname | Hostname of instances | `string` | `""` | no | | hostname\_suffix\_separator | Separator character to compose hostname when add\_hostname\_suffix is set to true. | `string` | `"-"` | no | | instance\_template | Instance template self\_link used to create compute instances | `any` | n/a | yes | +| ipv6\_access\_config | IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. |
network = string
subnetwork = string
subnetwork_project = string
network_ip = string
access_config = list(object({
nat_ip = string
network_tier = string
}))
ipv6_access_config = list(object({
network_tier = string
}))
}))
list(list(object({| `[]` | no | | named\_ports | Named name and named port |
network_tier = string
})))
list(object({| `[]` | no | | network | Network to deploy to. Only one of network or subnetwork should be specified. | `string` | `""` | no | | num\_instances | Number of instances to create. This value is ignored if static\_ips is provided. | `string` | `"1"` | no | diff --git a/modules/umig/main.tf b/modules/umig/main.tf index a3a96e77..12c30094 100644 --- a/modules/umig/main.tf +++ b/modules/umig/main.tf @@ -64,6 +64,14 @@ resource "google_compute_instance_from_template" "compute_instance" { network_tier = access_config.value.network_tier } } + + dynamic "ipv6_access_config" { + # convert to map to use lookup function with default value + for_each = lookup({ for k, v in var.ipv6_access_config : k => v }, count.index, []) + content { + network_tier = ipv6_access_config.value.network_tier + } + } } dynamic "network_interface" { @@ -80,6 +88,12 @@ resource "google_compute_instance_from_template" "compute_instance" { network_tier = access_config.value.network_tier } } + dynamic "ipv6_access_config" { + for_each = network_interface.value.ipv6_access_config + content { + network_tier = ipv6_access_config.value.network_tier + } + } } } diff --git a/modules/umig/variables.tf b/modules/umig/variables.tf index 7b18c17f..7eb47bad 100644 --- a/modules/umig/variables.tf +++ b/modules/umig/variables.tf @@ -52,6 +52,9 @@ variable "additional_networks" { nat_ip = string network_tier = string })) + ipv6_access_config = list(object({ + network_tier = string + })) })) } @@ -93,6 +96,14 @@ variable "access_config" { default = [] } +variable "ipv6_access_config" { + description = "IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access." + type = list(list(object({ + network_tier = string + }))) + default = [] +} + variable "hostname_suffix_separator" { type = string description = "Separator character to compose hostname when add_hostname_suffix is set to true." diff --git a/modules/umig/versions.tf b/modules/umig/versions.tf index e430355b..028ea4a9 100644 --- a/modules/umig/versions.tf +++ b/modules/umig/versions.tf @@ -17,7 +17,7 @@ terraform { required_version = ">=0.13.0" required_providers { - google = ">= 3.71, < 5.0" + google = ">= 3.88, < 5.0" } provider_meta "google" { module_name = "blueprints/terraform/terraform-google-vm:umig/v7.9.0"
name = string
port = number
}))