terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

Support google_compute_network update to IPv6

Open synack-badamson opened this issue 1 year ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

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)

  • google_compute_network

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

synack-badamson avatar Feb 09 '24 23:02 synack-badamson