Open Razaekel opened 1 year ago
I can confirm this. I get the same error when trying to get the top-level dataset. When adding a sub dataset it works flawless. e.g.:
data "truenas_dataset" "test" {
dataset_id = "Tank"
}
Ok I think Iw as wrong. And maybe @Razaekel as well. It considered the pool to be the top-level dataset. WHat is obviously not correct.
The dataset ID is pool/dataset
.
Correct, top-level import or data query fails. A friendlier error description would be welcome.
Stack trace from the terraform-provider-truenas_v0.11.1 plugin:
panic: runtime error: slice bounds out of range [1:0]
goroutine 25 [running]:
github.com/dariusbakunas/terraform-provider-truenas/truenas.newDatasetPath({0x140000350c0?, 0x104992948?})
github.com/dariusbakunas/terraform-provider-truenas/truenas/resource_truenas_dataset.go:40 +0x14c
github.com/dariusbakunas/terraform-provider-truenas/truenas.dataSourceTrueNASDatasetRead({0x104992948, 0x1400007e5a0}, 0x0?, {0x1048d4960?, 0x140004b46c0})
github.com/dariusbakunas/terraform-provider-truenas/truenas/data_source_truenas_dataset.go:479 +0x310
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x14000448b60, {0x104992980, 0x140002325d0}, 0xd?, {0x1048d4960, 0x140004b46c0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:724 +0xec
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0x14000448b60, {0x104992980, 0x140002325d0}, 0x14000537900, {0x1048d4960, 0x140004b46c0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:943 +0x118
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0x140000a7218, {0x104992980?, 0x14000232390?}, 0x1400007c6e0)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/grpc_provider.go:1179 +0x304
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0x140000fc460, {0x104992980?, 0x14000611d40?}, 0x14000116550)
github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/tf5server/server.go:658 +0x36c
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x104952780?, 0x140000fc460}, {0x104992980, 0x14000611d40}, 0x14000549880, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:421 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000464000, {0x104995500, 0x140004a8340}, 0x14000353680, 0x14000467020, 0x104e60770, 0x0)
google.golang.org/grpc@v1.50.1/server.go:1340 +0xb90
google.golang.org/grpc.(*Server).handleStream(0x14000464000, {0x104995500, 0x140004a8340}, 0x14000353680, 0x0)
google.golang.org/grpc@v1.50.1/server.go:1713 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.50.1/server.go:965 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.50.1/server.go:963 +0x298
Error: The terraform-provider-truenas_v0.11.1 plugin crashed!
Attempting to import the Top level dataset (System Dataset Pool) causes the plugin to crash with an 'out of bounds' error.