yandex-cloud / terraform-provider-yandex

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

Provider crash when trying to create yandex_vpc_private_endpoint #471

Closed kashtan404 closed 2 weeks ago

kashtan404 commented 1 month ago

Доброго времени суток! По просьбе нам включили создание сервисных подключений, но при попытке создать их тераформом, он падает с ошибкой.

версии:

% terraform version
Terraform v1.9.5
on darwin_amd64
+ provider registry.terraform.io/hashicorp/helm v2.15.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.32.0
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.3
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/hashicorp/time v0.12.1
+ provider registry.terraform.io/hashicorp/vault v4.4.0
+ provider registry.terraform.io/yandex-cloud/yandex v0.129.0

код тераформа:

resource "yandex_vpc_private_endpoint" "infra" {
  name = "default-s3-private-endpoint"

  network_id = "***"

  object_storage {}

  endpoint_address {
    subnet_id = "***"
  }
}

diff:

Terraform will perform the following actions:

  # module.network.yandex_vpc_private_endpoint.infra will be created
  + resource "yandex_vpc_private_endpoint" "infra" {
      + created_at = (known after apply)
      + folder_id  = (known after apply)
      + id         = (known after apply)
      + labels     = (known after apply)
      + name       = "default-s3-private-endpoint"
      + network_id = "***"
      + status     = (known after apply)

      + dns_options (known after apply)

      + endpoint_address {
          + address    = (known after apply)
          + address_id = (known after apply)
          + subnet_id  = "***"
        }

      + object_storage {}
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Ошибка:

module.network.yandex_vpc_private_endpoint.infra: Creating...
╷
│ Warning: Applied changes may be incomplete
│
│ The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending:
│     terraform plan
│
│ Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: Request cancelled
│
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

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

panic: interface conversion: interface {} is []interface {}, not []map[string]string

goroutine 53 [running]:
github.com/yandex-cloud/terraform-provider-yandex/yandex.expandPrivateEndpointAddressSpec(0x11fd19f?)
        github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_vpc_private_endpoint.go:398 +0x24b
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexVPCPrivateEndpointCreate(0x0?, {0x2f10c20?, 0xc00096cdc0?})
        github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_vpc_private_endpoint.go:151 +0x205
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x36fed78?, {0x36fed78?, 0xc000bef380?}, 0xd?, {0x2f10c20?, 0xc00096cdc0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:766 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000cf1ce0, {0x36fed78, 0xc000bef380}, 0xc000d27930, 0xc000f2f500, {0x2f10c20, 0xc00096cdc0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00080fda0, {0x36fed78?, 0xc000bef1d0?}, 0xc000697e50)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xdbc
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x370c700?, 0xc00080fda0?}}, {0x36fed78, 0xc000bef1d0}, 0x0?)
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5to6server/tf5to6server.go:47 +0x54
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0x36fedb0?, {0x36fed78?, 0xc000beeed0?}, 0xc000697e00)
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000699220, {0x36fed78?, 0xc000abe0f0?}, 0xc000f6a5b0)
        github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/tf6server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x31b2460?, 0xc000699220}, {0x36fed78, 0xc000abe0f0}, 0xc000f2e000, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000b27e00, {0x36fed78, 0xc000e218c0}, {0x3709ca8, 0xc000dbd1e0}, 0xc000e9f7a0, 0xc000db51d0, 0x536d798, 0x0)
        google.golang.org/grpc@v1.66.0/server.go:1393 +0xe56
google.golang.org/grpc.(*Server).handleStream(0xc000b27e00, {0x3709ca8, 0xc000dbd1e0}, 0xc000e9f7a0)
        google.golang.org/grpc@v1.66.0/server.go:1804 +0x1016
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.66.0/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 50
        google.golang.org/grpc@v1.66.0/server.go:1040 +0x135

Error: The terraform-provider-yandex_v0.129.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.
raorn commented 3 weeks ago

Было исправлено в 5fefc29f08ca436386ad59fa80b61041c00d6a7d (v0.130.0)