hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.73k forks source link

Support google_compute_network update to IPv6 #17244

Open synack-badamson opened 7 months ago

synack-badamson commented 7 months ago

Community Note

Description

We currently cannot enable internal IPv6 on existing networks using Terraform. Terraform forces replacement of the network, which then forces recreation of downstream resources. ForceNew is set on both fields enable_ula_internal_ipv6 and internal_ipv6_range.

  # module.vpc.module.vpc.google_compute_network.network must be replaced
-/+ resource "google_compute_network" "network" {
      ~ enable_ula_internal_ipv6                  = false -> true # forces replacement
      + gateway_ipv4                              = (known after apply)
      ~ id                                        = "projects/projectname/global/networks/ipv4v6-test" -> (known after apply)
      + internal_ipv6_range                       = "fd20:0:1234::/48" # forces replacement
        name                                      = "ipv4v6-test"
      ~ numeric_id                                = "12345678901234567890" -> (known after apply)
      ~ self_link                                 = "https://www.googleapis.com/compute/v1/projects/projectname/global/networks/ipv4v6-test" -> (known after apply)
        # (6 unchanged attributes hidden)
    }

We are able to enable this feature through Console or gcloud without recreation, following this documentation.

New or Affected Resource(s)

Potential Terraform Configuration

We're using the network module, but that's not important.

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

    project_id   = "projectname"
    network_name = "ipv4v6-test"
    routing_mode = "GLOBAL"
    enable_ipv6_ula = "true"
    internal_ipv6_range = "fd20:0:1234::/48"
    subnets = [
        # subnets here
    ]

    routes = [
        # routes here
    ]
}

References

b/325031323

fmodarelli commented 3 weeks ago

Hi! We're experiencing the same, please thumbs up everybody!