scylladb / terraform-provider-scylladbcloud

Terraform provider for ScyllaDB Cloud.
https://registry.terraform.io/providers/scylladb/scylladbcloud/latest
Apache License 2.0
11 stars 10 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #140

Closed susiesolis closed 7 months ago

susiesolis commented 7 months ago

Provider crashes during Terraform state refresh when reading the vpc peering resource block.

resource "scylladbcloud_vpc_peering" "example" {
    cluster_id = 22738
    datacenter = "GCE_US_EAST_1"

    peer_vpc_id     = google_compute_network.app.name
    peer_region     = "us-east1"
    peer_account_id = "skilled-adapter-452"

    allow_cql = true

}
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform planned the following actions, but then encountered a problem:

  # scylladbcloud_cluster.example must be replaced
-/+ resource "scylladbcloud_cluster" "example" {
      + alternator_write_isolation = "only_rmw_uses_lwt" # forces replacement
      ~ cidr_block                 = "172.31.0.0/16" -> (known after apply)
      ~ cluster_id                 = 22738 -> (known after apply)
      ~ datacenter                 = "GCE_US_EAST_1" -> (known after apply)
      ~ id                         = "22738" -> (known after apply)
        name                       = "Team1"
      ~ node_disk_size             = 750 -> (known after apply)
      ~ node_dns_names             = [
          - "node-0.gce-us-east-1.6e1bb46c44a12accca80.clusters.scylla.cloud",
          - "node-1.gce-us-east-1.6e1bb46c44a12accca80.clusters.scylla.cloud",
          - "node-2.gce-us-east-1.6e1bb46c44a12accca80.clusters.scylla.cloud",
        ] -> (known after apply)
      ~ node_private_ips           = [
          - "172.31.0.3",
          - "172.31.0.4",
          - "172.31.0.5",
        ] -> (known after apply)
      ~ request_id                 = 70381 -> (known after apply)
      ~ scylla_version             = "2024.1.2" -> (known after apply)
      ~ status                     = "ACTIVE" -> (known after apply)
        # (7 unchanged attributes hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Changes to Outputs:
  ~ scylladbcloud_cluster_datacenter = "GCE_US_EAST_1" -> (known after apply)
  ~ scylladbcloud_cluster_id         = "22738" -> (known after apply)
╷
│ Error: Plugin did not respond
│ 
│   with scylladbcloud_vpc_peering.example,
│   on main.tf line 112, in resource "scylladbcloud_vpc_peering" "example":
│  112: resource "scylladbcloud_vpc_peering" "example" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-scylladbcloud_v1.6.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1005faee4]

goroutine 28 [running]:
github.com/scylladb/terraform-provider-scylladbcloud/internal/provider/vpcpeering.resourceVPCPeeringRead({0x1009d2d40, 0x140000a6a10}, 0x140000a4880, {0x1009aef60?, 0x1400053c180})
        github.com/scylladb/terraform-provider-scylladbcloud/internal/provider/vpcpeering/vpc_peering.go:290 +0x484
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x14000173500, {0x1009d2c98, 0x1400039d380}, 0x140000a4880, {0x1009aef60, 0x1400053c180})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:795 +0xe4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x14000173500, {0x1009d2c98, 0x1400039d380}, 0x1400052a820, {0x1009aef60, 0x1400053c180})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:1089 +0x408
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x14000125710, {0x1009d2c98?, 0x1400039d2c0?}, 0x1400053c340)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:667 +0x3e4
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadResource(0x14000235030, {0x1009d2c98?, 0x1400039cff0?}, 0x1400053c340)
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_ReadResource.go:35 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x1400023afa0, {0x1009d2c98?, 0x1400039c870?}, 0x140006201e0)
        github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/tf5server/server.go:775 +0x3c8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x1009a2480, 0x1400023afa0}, {0x1009d2c98, 0x1400039c870}, 0x140000a4600, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400019d000, {0x1009d2c98, 0x1400039c7e0}, {0x1009d76a0, 0x1400036c340}, 0x140002ca5a0, 0x14000364d20, 0x100ed09a8, 0x0)
        google.golang.org/grpc@v1.62.1/server.go:1386 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x1400019d000, {0x1009d76a0, 0x1400036c340}, 0x140002ca5a0)
        google.golang.org/grpc@v1.62.1/server.go:1797 +0xb10
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.62.1/server.go:1027 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 25
        google.golang.org/grpc@v1.62.1/server.go:1038 +0x13c

Error: The terraform-provider-scylladbcloud_v1.6.0 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.
rjeczalik commented 7 months ago

Fixed by #133