Cloud-Temple / terraform-provider-cloudtemple

Cloud Temple CSP Terraform Provider
https://cloud-temple.com
Mozilla Public License 2.0
8 stars 1 forks source link

data cloudtemple_compute_content_library_items makes the plugin crash #118

Closed mars4life closed 7 months ago

mars4life commented 7 months ago

Describe the bug When trying to use the data "cloudtemple_compute_content_library_items", it makes the plugin crash

Current Behavior

│ Error: Plugin did not respond │ │ with data.cloudtemple_compute_content_library_items.wllist, │ on library.tf line 9, in data "cloudtemple_compute_content_library_items" "wllist": │ 9: data "cloudtemple_compute_content_library_items" "wllist" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more
│ details. ╵

Stack trace from the terraform-provider-cloudtemple_v0.12.1.exe plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 55 [running]: github.com/cloud-temple/terraform-provider-cloudtemple/internal/provider.dataSourceContentLibraryItems.func1({0x1640c88, 0xc0002de420}, 0x20?, 0x1464180?, 0xc0002de401?) github.com/cloud-temple/terraform-provider-cloudtemple/internal/provider/data_source_compute_content_library_items.go:17 +0x26c github.com/cloud-temple/terraform-provider-cloudtemple/internal/provider.readFullResource.func1({0x1640c88?, 0xc0002de420?}, 0x0?, 0x0?, 0x0?)
github.com/cloud-temple/terraform-provider-cloudtemple/internal/provider/helper.go:75 +0x28 github.com/cloud-temple/terraform-provider-cloudtemple/internal/provider.readResource.func1({0x1640c88, 0xc0002de420}, 0xc0003e6400, {0x14c6d40?, 0xc0001a02d0}) github.com/cloud-temple/terraform-provider-cloudtemple/internal/provider/helper.go:58 +0xdb github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).read(0xc00040e540, {0x1640cc0, 0xc0000e2b40}, 0xd?, {0x14c6d40, 0xc0001a02d0}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:750 +0x12e github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).ReadDataApply(0xc00040e540, {0x1640cc0, 0xc0000e2b40}, 0xc0003e6300, {0x14c6d40, 0xc0001a02d0}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:970 +0x150 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ReadDataSource(0xc00009b170, {0x1640cc0?, 0xc0000e2a20?}, 0xc000090100) github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/grpc_provider.go:1198 +0x38f github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ReadDataSource(0xc0000ce1e0, {0x1640cc0?, 0xc0000e2150?}, 0xc0002a2370)
github.com/hashicorp/terraform-plugin-go@v0.16.0/tfprotov5/tf5server/server.go:661 +0x3ef github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x14db7e0?, 0xc0000ce1e0}, {0x1640cc0, 0xc0000e2150}, 0xc00032a070, 0x0) github.com/hashicorp/terraform-plugin-go@v0.16.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:458 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc0000f4000, {0x16439a0, 0xc0002981a0}, 0xc0003de7e0, 0xc00046e060, 0x1af51f0, 0x0) google.golang.org/grpc@v1.56.0/server.go:1337 +0xde3 google.golang.org/grpc.(Server).handleStream(0xc0000f4000, {0x16439a0, 0xc0002981a0}, 0xc0003de7e0, 0x0) google.golang.org/grpc@v1.56.0/server.go:1714 +0xa1b google.golang.org/grpc.(Server).serveStreams.func1.1() google.golang.org/grpc@v1.56.0/server.go:959 +0x98 created by google.golang.org/grpc.(Server).serveStreams.func1 google.golang.org/grpc@v1.56.0/server.go:957 +0x18c

Error: The terraform-provider-cloudtemple_v0.12.1.exe 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

it should just read all the library items available

Steps to reproduce

Steps to reproduce the behavior:

  1. using terraform version 1.6.4
  2. using provider version 0.12.1
  3. terraform configuration is something like that:

data "cloudtemple_compute_content_library" "wl" { name = "wl-baseboxes" } data "cloudtemple_compute_content_library_items" "wllist" { content_library_id = data.cloudtemple_compute_content_library.wl.id }

  1. terraform plan crash with the stack trace shown before
pbesret commented 7 months ago

Hello,

Sorry for the delay. I will take a look rapidly. As a workaround, could you use the datasource cloudtemple_compute_content_library_item (singular). This is the most commonly used between the two.

Thanks for understanding, Best regards.