sematext / terraform-provider-sematext

Sematext Terraform Provider
https://sematext.com
Mozilla Public License 2.0
3 stars 1 forks source link

Missing import resource documentation #59

Open Invincibear opened 2 weeks ago

Invincibear commented 2 weeks ago

The codebase appears to support importing existing Sematext resources into Terraform state, but there are no examples in the documentation. I tried importing just my infra app's id and the provider crashed:

tf import sematext_app_infra.aks_cluster my_five_digit_infra_app_id_number

╷
│ Error: Plugin did not respond
│ 
│ 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-sematext_v0.6.1 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 15 [running]:
github.com/sematext/terraform-provider-sematext/sematext.extractAppTokenNames({0xce0940?, 0xc0004c8520?})
    github.com/sematext/terraform-provider-sematext/sematext/functions.go:101 +0x1ba
github.com/sematext/terraform-provider-sematext/sematext.ResourceOperationReadApp({0xe37948, 0xc0002348a0}, 0xc00019d680, {0xc5c6e0?, 0xc00024e1c0}, {0xd0e653, 0x5})
    github.com/sematext/terraform-provider-sematext/sematext/resource_operation_app.go:180 +0x565
github.com/sematext/terraform-provider-sematext/sematext/generated.resourceOperationReadAppInfra({0xe37948?, 0xc0002348a0?}, 0x0?, {0xc5c6e0?, 0xc00024e1c0?})
    github.com/sematext/terraform-provider-sematext/sematext/generated/resource_app_infra.go:40 +0x3a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc00021bce0, {0xe37980, 0xc000234030}, 0xd?, {0xc5c6e0, 0xc00024e1c0})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:724 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc00021bce0, {0xe37980, 0xc000234030}, 0xc0001c1ad0, {0xc5c6e0, 0xc00024e1c0})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:1015 +0x585
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0003c4408, {0xe37980?, 0xc00018fef0?}, 0xc00018ca00)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/grpc_provider.go:613 +0x4a5
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc000199ae0, {0xe37980?, 0xc00018f530?}, 0xc000115c20)
    github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov5/tf5server/server.go:748 +0x4b1
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xce07e0?, 0xc000199ae0}, {0xe37980, 0xc00018f530}, 0xc0000d62a0, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:383 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001b01e0, {0xe3b858, 0xc000402340}, 0xc0004c0c60, 0xc0003da4b0, 0x133f7f0, 0x0)
    google.golang.org/grpc@v1.55.0/server.go:1337 +0xdf3
google.golang.org/grpc.(*Server).handleStream(0xc0001b01e0, {0xe3b858, 0xc000402340}, 0xc0004c0c60, 0x0)
    google.golang.org/grpc@v1.55.0/server.go:1714 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
    google.golang.org/grpc@v1.55.0/server.go:959 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.55.0/server.go:957 +0x18c

Error: The terraform-provider-sematext_v0.6.1 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.