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 provider plugin crashed when adding network_interface.internal_ipv6_prefix_length in compute_instance #21505

Open
Terrafault opened this issue Feb 20, 2025 · 1 comment

Comments

@Terrafault
Copy link

Terrafault commented Feb 20, 2025

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

Initial state

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"
  allow_stopping_for_update = true
  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"
    }
  }
}

Updated state, only thing changed is adding the line of internal_ipv6_prefix_length = 1

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"
  allow_stopping_for_update = true
  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 = 1 # ADDED TO TRIGGER BUG
  }
}

Debug Output

╷
│ Error: Request cancelled
│ 
│   with google_compute_instance.vm_instance,
│   on s1.tf line 20, in resource "google_compute_instance" "vm_instance":
│   20: resource "google_compute_instance" "vm_instance" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-google_v6.21.0_x5 plugin:

panic: interface conversion: interface {} is int, not int64

goroutine 76 [running]:
github.com/hashicorp/terraform-provider-google/google/services/compute.resourceComputeInstanceUpdate(0x14001e56100, {0x1049af120, 0x14001206008})
        github.com/hashicorp/terraform-provider-google/google/services/compute/resource_compute_instance.go:2211 +0x5bfc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x104a253a8?, {0x104a253a8?, 0x1400173f980?}, 0xd?, {0x1049af120?, 0x14001206008?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:800 +0x130
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140010eefc0, {0x104a253a8, 0x1400173f980}, 0x140011ed5f0, 0x1400172ff00, {0x1049af120, 0x14001206008})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:919 +0x660
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14000e17188, {0x104a253a8?, 0x1400173f8c0?}, 0x14001739d60)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xaa4
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x140003b4880, {0x104a253a8?, 0x1400173f5f0?}, 0x14001739d60)
        github.com/hashicorp/terraform-plugin-mux@v0.17.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140000bfae0, {0x104a253a8?, 0x1400173eb70?}, 0x140005836c0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/tf5server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x10496d240, 0x140000bfae0}, {0x104a253a8, 0x1400173eb70}, 0x1400172f300, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140001ab800, {0x104a253a8, 0x1400173eae0}, 0x140012f0d80, 0x1400129cba0, 0x106981378, 0x0)
        google.golang.org/grpc@v1.70.0/server.go:1400 +0xca8
google.golang.org/grpc.(*Server).handleStream(0x140001ab800, {0x104a25c70, 0x140011ea680}, 0x140012f0d80)
        google.golang.org/grpc@v1.70.0/server.go:1810 +0x910
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.70.0/server.go:1030 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 54
        google.golang.org/grpc@v1.70.0/server.go:1041 +0x13c

Error: The terraform-provider-google_v6.21.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behavior

Two possibilities

  1. In-place update of the compute instance's NIC IPv6 prefix length
  2. Recreation of the compute instance to use a new NIC with new IPv6 prefix length

Actual Behavior

Plugin directly crashes with the error message above.

Steps to reproduce

  1. terraform apply on initial state
  2. terraform apply on update state

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
Development

No branches or pull requests

2 participants