aiven / terraform-provider-aiven

Aiven Terraform Provider
https://registry.terraform.io/providers/aiven/aiven/latest/docs
MIT License
128 stars 69 forks source link

userPeerNetworkCidrs cannot convert interface #1186

Closed pgodschalk closed 1 year ago

pgodschalk commented 1 year ago

What happened?

Plugin crashes 🤷

What did you expect to happen?

Plugin doesn't crash 😄

What else do we need to know?

resource "aiven_transit_gateway_vpc_attachment" "redacted" {
  peer_cloud_account      = var.project_id
  peer_vpc                = "redacted"
  peer_region             = var.region
  user_peer_network_cidrs = [var.cluster_subnet_ip_range]
  vpc_id                  = aiven_project_vpc.this.id
}
# aiven_transit_gateway_vpc_attachment.redacted will be created
  + resource "aiven_transit_gateway_vpc_attachment" "redacted" {
      + id                      = (known after apply)
      + peer_cloud_account      = "redacted"
      + peer_region             = "europe-west4"
      + peer_vpc                = "redacted"
      + peering_connection_id   = (known after apply)
      + state                   = (known after apply)
      + state_info              = (known after apply)
      + user_peer_network_cidrs = [
          + "10.2.0.0/17",
        ]
      + vpc_id                  = "redacted/redacted"
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aiven_transit_gateway_vpc_attachment.redacted: Creating...
â•·
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵
â•·
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).UpgradeResourceState call. The plugin logs may
│ contain more details.
╵

Stack trace from the terraform-provider-aiven_v4.4.1 plugin:

panic: interface conversion: interface {} is *schema.Set, not []interface {}

goroutine 37 [running]:
github.com/aiven/terraform-provider-aiven/internal/sdkprovider/service/vpc.resourceVPCPeeringConnectionCreate({0x100e96be8, 0x14000914840}, 0x0?, {0x100e48d40?, 0x14000162180})
        github.com/aiven/terraform-provider-aiven/internal/sdkprovider/service/vpc/vpc_peering_connection.go:40 +0xabc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x140003ecd20, {0x100e96c20, 0x1400031ae40}, 0xd?, {0x100e48d40, 0x14000162180})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:707 +0xec
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140003ecd20, {0x100e96c20, 0x1400031ae40}, 0x14000991d40, 0x14000937200, {0x100e48d40, 0x14000162180})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:837 +0x874
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x140000b8498, {0x100e96c20?, 0x1400031ac60?}, 0x14000364960)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/grpc_provider.go:1021 +0xb94
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x100e9a0c0?, 0x140000b8498?}}, {0x100e96c20, 0x1400031ac60}, 0x0?)
        github.com/hashicorp/terraform-plugin-mux@v0.10.0/tf5to6server/tf5to6server.go:34 +0x5c
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.muxServer.ApplyResourceChange({0x1400060c810, 0x1400060c870, {0x1400053f6a0, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
        github.com/hashicorp/terraform-plugin-mux@v0.10.0/tf6muxserver/mux_server_ApplyResourceChange.go:27 +0xdc
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x140003bb180, {0x100e96c20?, 0x140002ba2d0?}, 0x140005a60e0)
        github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov6/tf6server/server.go:816 +0x3c0
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x100e5f160?, 0x140003bb180}, {0x100e96c20, 0x140002ba2d0}, 0x140005a6070, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:419 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x140007b0780, {0x100e999a0, 0x140001aad00}, 0x14000a44a20, 0x14000827d40, 0x1013dfe20, 0x0)
        google.golang.org/grpc@v1.54.0/server.go:1345 +0xc7c
google.golang.org/grpc.(*Server).handleStream(0x140007b0780, {0x100e999a0, 0x140001aad00}, 0x14000a44a20, 0x0)
        google.golang.org/grpc@v1.54.0/server.go:1722 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.54.0/server.go:966 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.54.0/server.go:964 +0x298

Error: The terraform-provider-aiven_v4.4.1 plugin crashed!
terraform version
Terraform v1.4.6
on darwin_arm64
+ provider registry.terraform.io/aiven/aiven v4.4.1
+ provider registry.terraform.io/hashicorp/consul v2.17.0
+ provider registry.terraform.io/hashicorp/google v4.65.2
+ provider registry.terraform.io/hashicorp/local v2.4.0
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/vault v3.15.2
Serpentiel commented 1 year ago

hey 👋

thanks for reporting this, our team will investigate this and will get back to you soon :)

Serpentiel commented 1 year ago

hey again 👋 this should be resolved under #1204, hopefully it gets merged and released soon!

Serpentiel commented 1 year ago

hey 👋 this has been resolved, please stay tuned, we'll be rolling out a release soon!