Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_compute_instance.network_interface.internal_ipv6_prefix_length value is not sync with Terraform #21520

Open
jingjia-peng opened this issue Feb 20, 2025 · 0 comments · May be fixed by GoogleCloudPlatform/magic-modules#13133

Comments

@jingjia-peng
Copy link

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 an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform v1.10.5
on darwin_arm64

  • provider registry.terraform.io/hashicorp/google v6.21.0

Affected Resource(s)

  • google_compute_instance
  • google_compute_subnetwork
  • google_compute_network

Terraform Configuration

resource "google_compute_network" "vpc_network" {
  project                 = "my-project"
  name                    = "terraform-network"
  auto_create_subnetworks = "false"
  enable_ula_internal_ipv6 = true
}

resource "google_compute_subnetwork" "subnetwork" {
  project = "my-project"
  name    = "ipv6-test-subnetwork"

  ip_cidr_range = "10.0.0.0/22"
  region        = "us-central1"

  stack_type       = "IPV4_IPV6"
  ipv6_access_type = "INTERNAL"

  network = google_compute_network.vpc_network.id
}

resource "google_compute_instance" "vm_instance" {
  project                   = "my-project"
  name                      = "terraform-instance"
  machine_type              = "e2-micro"
  zone                      = "us-central1-c"
  boot_disk {
    auto_delete = false
    initialize_params {
      image = "debian-cloud/debian-11"
    }
  }
  network_interface {
    network    = google_compute_network.vpc_network.self_link
    subnetwork = google_compute_subnetwork.subnetwork.self_link
    stack_type = "IPV4_IPV6"
    access_config {
      network_tier = "STANDARD"
    }
    internal_ipv6_prefix_length = 96 # GCP NOT SYNCING ATTRIBUTE WITH TERRAFORM
  }
}

Debug Output

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # google_compute_instance.vm_instance will be updated in-place
  ~ resource "google_compute_instance" "vm_instance" {
        id                         = "projects/my-project/zones/us-central1-c/instances/terraform-instance"
        name                       = "terraform-instance"
        tags                       = []
        # (23 unchanged attributes hidden)

      ~ network_interface {
          ~ internal_ipv6_prefix_length = 0 -> 96
            name                        = "nic0"
            # (9 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }

        # (3 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
google_compute_instance.vm_instance: Modifying... [id=projects/iac-lifting-test/zones/us-central1-c/instances/terraform-instance]

Expected Behavior

After terraform apply once using the configuration above and terraform apply again without any modification on the configuration, nothing should be changed.

Actual Behavior

Terraform thinks the google_compute_instance.network_interface.internal_ipv6_prefix_length is 0 instead of 96 as specified in the configuration, so it plans again and again with the debug output above. What's worse, this trigger the plugin crash as described in #21505

Steps to reproduce

  1. terraform apply to create all the resource
  2. terraform apply again, then we'll see the debug output above as well as the crash message in Google provider plugin crashed when adding network_interface.internal_ipv6_prefix_length in compute_instance #21505

Important Factoids

No response

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant