yandex-cloud / terraform-provider-yandex

Terraform Yandex provider
https://www.terraform.io/docs/providers/yandex/
Mozilla Public License 2.0
208 stars 113 forks source link

Crash when terraform import yandex_mdb_kafka_user... #430

Open Rom888 opened 5 months ago

Rom888 commented 5 months ago

The command:

terraform import yandex_mdb_kafka_user.kafka-test-user $cluster-id:test

Everything is fine with version 0.113.0, but with versions 0.114.0 and 0.115.0 the following error occurs:

data.yandex_mdb_kafka_cluster.kafka-stage: Reading...
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ReadDataSource request was cancelled.
╵

╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ReadDataSource request was cancelled.
╵

Stack trace from the terraform-provider-yandex_v0.115.0 plugin:

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

goroutine 50 [running]:
github.com/yandex-cloud/terraform-provider-yandex/yandex.checkNameFieldUsage(0xc001e372f0?)
    github.com/yandex-cloud/terraform-provider-yandex/yandex/mdb_postgresql_structures.go:859 +0x157
github.com/yandex-cloud/terraform-provider-yandex/yandex.flattenPGHostsFromHostInfos(0x27cef00?, {0xc0000124f8, 0x1, 0xc0015729d8?}, 0x1)
    github.com/yandex-cloud/terraform-provider-yandex/yandex/mdb_postgresql_structures.go:833 +0x45
github.com/yandex-cloud/terraform-provider-yandex/yandex.dataSourceYandexMDBPostgreSQLClusterRead(0x0?, {0x2177e80?, 0xc00046d8c0})
    github.com/yandex-cloud/terraform-provider-yandex/yandex/data_source_yandex_mdb_postgresql_cluster.go:470 +0x632
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).read(0x27cef00?, {0x27cef00?, 0xc000719230?}, 0xd?, {0x2177e80?, 0xc00046d8c0?})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:783 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).ReadDataApply(0xc000b3c9a0, {0x27cef00, 0xc000719230}, 0xc00073c480, {0x2177e80, 0xc00046d8c0})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:1015 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ReadDataSource(0xc000010ae0, {0x27cef00?, 0xc0007190b0?}, 0xc00093e120)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1291 +0x38f
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ReadDataSource({{0x27da260?, 0xc000010ae0?}}, {0x27cef00?, 0xc0007190b0?}, 0xc00093e100?)
    github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5to6server/tf5to6server.go:204 +0x216
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(muxServer).ReadDataSource(0x27cee58?, {0x27cef00?, 0xc000718d80?}, 0xc00093e100)
    github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf6muxserver/mux_server_ReadDataSource.go:36 +0x1b5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(server).ReadDataSource(0xc000cc0320, {0x27cef00?, 0xc0007183c0?}, 0xc00071a1e0)
    github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/tf6server/server.go:686 +0x432
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadDataSource_Handler({0x23bd940?, 0xc000cc0320}, {0x27cef00, 0xc0007183c0}, 0xc00073c000, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:572 +0x170
google.golang.org/grpc.(Server).processUnaryRPC(0xc000ca4800, {0x27cef00, 0xc000718330}, {0x27d8260, 0xc000103520}, 0xc000720120, 0xc00096c510, 0x413a660, 0x0)
    google.golang.org/grpc@v1.62.1/server.go:1386 +0xe69
google.golang.org/grpc.(Server).handleStream(0xc000ca4800, {0x27d8260, 0xc000103520}, 0xc000720120)
    google.golang.org/grpc@v1.62.1/server.go:1797 +0x1051
google.golang.org/grpc.(Server).serveStreams.func2.1()
    google.golang.org/grpc@v1.62.1/server.go:1027 +0x91
created by google.golang.org/grpc.(*Server).serveStreams.func2
    google.golang.org/grpc@v1.62.1/server.go:1038 +0x145

Error: The terraform-provider-yandex_v0.115.0 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.