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

Provider Crashed #407

Closed Caoimhin89 closed 1 month ago

Caoimhin89 commented 8 months ago

Hi! When attemptying to apply terraform, I received an error stating that the Provider Plugin crashed. The terraform contians 54 resources, and both terraform plan and terraform validate run without errors. Please let me know if I need to provide the details of the terraform plan or config files.

Below is the progress of the applying the terraform prior to the crash:

module.payments_microservice.yandex_kms_symmetric_key.service-key: Creating...
module.network_layer.module.vpc.yandex_vpc_gateway.egress-gateway: Creating...
module.orders_microservice.yandex_kms_symmetric_key.service-key: Creating...
module.network_layer.module.vpc.yandex_vpc_network.network: Creating...
yandex_resourcemanager_folder.birzha-project-folder: Creating...
module.network_layer.module.private_dns.yandex_cm_certificate.certificate: Creating...
module.network_layer.module.public_dns.yandex_cm_certificate.certificate: Creating...

And the following stacktrace was included in the error:

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.
╵
╷
│ 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.
╵
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
╷
│ 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.
╵
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

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

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

goroutine 180 [running]:
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexCMCertificateCreateManagedByLetsEncrypt({0x3263c48, 0xc001983110}, 0xc000db4000, {0x2c4cde0?, 0xc000ce06e0?})
        github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_cm_certificate.go:411 +0xcf7
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexCMCertificateCreate({0x3263c48, 0xc001983110}, 0x0?, {0x2c4cde0, 0xc000ce06e0})
        github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_cm_certificate.go:465 +0xf9
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000f4b500, {0x3263c80, 0xc0016662a0}, 0xd?, {0x2c4cde0, 0xc000ce06e0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:778 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000f4b500, {0x3263c80, 0xc0016662a0}, 0xc0009581a0, 0xc00095a180, {0x2c4cde0, 0xc000ce06e0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000011638, {0x3263c80?, 0xc0016660c0?}, 0xc00161f0e0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/grpc_provider.go:1027 +0xe8d
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x326e1e8?, 0xc000011638?}}, {0x3263c80, 0xc0016660c0}, 0x0?)
        github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf5to6server/tf5to6server.go:37 +0x5a
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.muxServer.ApplyResourceChange({0xc001086840, 0xc0012e7c30, 0xc001086870, 0xc0010868a0, {0xc00107a220, 0x2, 0x2}}, {0x3263c80?, 0xc001651d70?}, 0xc00161f090)
        github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf6muxserver/mux_server_ApplyResourceChange.go:30 +0x139
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc0000fb360, {0x3263c80?, 0xc001651560?}, 0xc000725030)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/tf6server/server.go:819 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x2e43b40?, 0xc0000fb360}, {0x3263c80, 0xc001651560}, 0xc00160a780, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0006c3c20, {0x3263c80, 0xc0016514d0}, {0x326c9c0, 0xc000cfa680}, 0xc00164f200, 0xc0011226f0, 0x4ac3e00, 0x0)
        google.golang.org/grpc@v1.59.0/server.go:1343 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc0006c3c20, {0x326c9c0, 0xc000cfa680}, 0xc00164f200)
        google.golang.org/grpc@v1.59.0/server.go:1737 +0xca6
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.59.0/server.go:986 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.59.0/server.go:997 +0x15c

Error: The terraform-provider-yandex_v0.104.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.
Caoimhin89 commented 8 months ago

In deploying the modules individually, I discovered the underlying problems.

1) The name of the public certificate violated the naming convention by using underscores 2) Quota for the number of Networks exceeded 3) Quota for the number of YDB instances exceeded

After solving for those issues, the stack deploys successfully. So the Provider Plugin issue seems just to be related to Error Handling.

KoDA82 commented 8 months ago

Hi, could you please share with us an example which lead to this crash? We'll try to reproduce the problem and enhance error handling.

govyadkin commented 1 month ago

Can't reproducible