aiven / terraform-provider-aiven

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

panic: runtime error: index out of range [1] with length 1 #1610

Closed JonasDC2 closed 6 months ago

JonasDC2 commented 6 months ago

What happened?

I'm trying to add a new topic.

 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.

Stack trace from the terraform-provider-aiven_v4.9.3 plugin:
panic: runtime error: index out of range [1] with length 1
goroutine 61 [running]:
github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert.itemToAPI({0xc000ab2640, 0xa}, {0xf82b98, 0x6}, {0xc000c8bc40, 0x4, 0x4}, {0xc0005d42b8, 0x13}, {0xe0c140, ...}, ...)
    github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert/toapi.go:241 +0x7f9
github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert.arrayItemToAPI({0xc000ab2640, 0xa}, {0xc000c8bc40?, 0x3, 0x4}, {0xf82b8e, 0x10}, {0xc0005e8960, 0xf, 0xf}, ...)
    github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert/toapi.go:131 +0x730
github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert.itemToAPI({0xc000ab2640, 0xa}, {0xc000b58fd4, 0x5}, {0xc000c8bc40, 0x3, 0x4}, {0xf82b8e, 0x10}, {0xdfde00, ...}, ...)
    github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert/toapi.go:283 +0x429
github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert.propsToAPI({0xc000ab2640, 0xa}, {0xc00007f820?, 0x2, 0x2}, 0xc000c2e810, 0xc000a53220?, 0xe0c140?, {0x111e000, 0xc0000e4a00})
    github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert/toapi.go:424 +0x485
github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert.ToAPI(0x111d088?, {0xc000ab2640, 0xa}, {0x111e000, 0xc0000e4a00})
    github.com/aiven/terraform-provider-aiven/internal/schemautil/userconfig/apiconvert/toapi.go:471 +0x1e8
github.com/aiven/terraform-provider-aiven/internal/schemautil.ResourceServiceUpdate({0x111e718, 0xc00013ae70}, 0xc0000e4a00, {0xf2aa60?, 0xc000230fc0?})
    github.com/aiven/terraform-provider-aiven/internal/schemautil/service.go:493 +0x84a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc000205500, {0x111e670, 0xc000b45500}, 0xd?, {0xf2aa60, 0xc000230fc0})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/resource.go:812 +0x11b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000205500, {0x111e670, 0xc000b45500}, 0xc00051a820, 0xc0000e4880, {0xf2aa60, 0xc000230fc0})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/resource.go:919 +0x83a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000011068, {0x111e670?, 0xc000b452c0?}, 0xc0006ec9b0)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:1060 +0xdbc
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x1124de0?, 0xc000011068?}}, {0x111e670, 0xc000b452c0}, 0x0?)
    github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf5to6server/tf5to6server.go:37 +0x54
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0x111e6a8?, {0x111e670?, 0xc000b44ed0?}, 0xc0006ec960)
    github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc00035a280, {0x111e670?, 0xc000b44630?}, 0xc000c07490)
    github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/tf6server/server.go:857 +0x56a
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xf47de0?, 0xc00035a280}, {0x111e670, 0xc000b44630}, 0xc000c07420, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:467 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00021c000, {0x1123c30, 0xc0004824e0}, 0xc0009a8900, 0xc0005a3e30, 0x17a0fd8, 0x0)
    google.golang.org/grpc@v1.57.0/server.go:[136](xxxx)0 +0xe15
google.golang.org/grpc.(*Server).handleStream(0xc00021c000, {0x1123c30, 0xc0004824e0}, 0xc0009a8900, 0x0)
    google.golang.org/grpc@v1.57.0/server.go:1737 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
    google.golang.org/grpc@v1.57.0/server.go:982 +0x8d
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 25
    google.golang.org/grpc@v1.57.0/server.go:980 +0x[165](xxxxx)
Error: The terraform-provider-aiven_v4.9.3 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.

What did you expect to happen?

I'm not quite sure whats happing or what I expect to happen, I'm new to terraform, but as the description said report the bug, so I did. I'm trying to create a new topic (this has worked before. It's been broken for about 2 weeks now.)

What else do we need to know?

It only fails on apply, not plan.

The terraform-provider-aiven: 4.9.3 Terraform: 2.0.2

Serpentiel commented 6 months ago

Hey, @JonasDC2! 👋

Thanks for raising this question. I can see that you're running Terraform Provider v4.9.3.

Could you please upgrade to the latest v4.14.0 release and try it again? This should have been fixed already :)

I will close this issue for now, but please let me know if it still doesn't works on v4.14.0.