ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
35 stars 24 forks source link

Importing k8snodepool is not working #77

Closed arteonprifti closed 3 years ago

arteonprifti commented 3 years ago

Description

When trying to import an existing k8snodepool in terraform, the plugin crashes

Expected behavior

k8snodepool is successfully imported

Environment

Terraform version:

Terraform v1.0.4
on linux_amd64
+ provider registry.terraform.io/ionos-cloud/ionoscloud v6.0.0-beta.4

Configuration Files


resource "ionoscloud_k8s_cluster" "example" {
  k8s_version = "1.20.8"
  name        = "my-test-k8s"
  public      = true
  maintenance_window {
    day_of_the_week = "Sunday"
    time            = "01:02:39Z"
  }
}

resource "ionoscloud_k8s_node_pool" "example" {
}

How to Reproduce

terraform import ionoscloud_k8s_node_pool.example fda7e7d8-5075-48c5-b760-28087e09bf3c/3da10089-5e83-4e91-b1b4-897e6f7a1d25

Error and Debug Output

ionoscloud_k8s_node_pool.example: Importing from ID "fda7e7d8-5075-48c5-b760-28087e09bf3c/3da10089-5e83-4e91-b1b4-897e6f7a1d25"...
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ImportResourceState call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-ionoscloud_v6.0.0-beta.4 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10dac48]

goroutine 35 [running]:
github.com/ionos-cloud/terraform-provider-ionoscloud/ionoscloud.resourceK8sNodepoolImport(0x1572a28, 0xc0002a80c0, 0xc000198680, 0x129ad80, 0xc0004105b0, 0x1, 0x30, 0x7f2080755a68, 0x30, 0xc000558390)
    github.com/ionos-cloud/terraform-provider-ionoscloud/ionoscloud/utils.go:161 +0xc08
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).ImportState(0xc000094910, 0x1572a28, 0xc0002a80c0, 0xc000627aa8, 0xc000192050, 0x49, 0x203000, 0x203000, 0x203000, 0x0, ...)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.0/helper/schema/provider.go:367 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ImportResourceState(0xc00000c5e8, 0x1572a28, 0xc0002a80c0, 0xc0004b40a0, 0xc0002a80c0, 0x12fd160, 0xc000558100)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.7.0/helper/schema/grpc_provider.go:1021 +0xe5
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ImportResourceState(0xc0006c8600, 0x1572ad0, 0xc0002a80c0, 0xc00055a0a0, 0xc0006c8600, 0xc000558180, 0xc00034aba0)
    github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/server/server.go:349 +0xdc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ImportResourceState_Handler(0x12fd160, 0xc0006c8600, 0x1572ad0, 0xc000558180, 0xc0004fe180, 0x0, 0x1572ad0, 0xc000558180, 0xc000088150, 0x65)
    github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:398 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000236a80, 0x157c218, 0xc000103c80, 0xc000126100, 0xc000691530, 0x1c2c4d8, 0x0, 0x0, 0x0)
    google.golang.org/grpc@v1.32.0/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000236a80, 0x157c218, 0xc000103c80, 0xc000126100, 0x0)
    google.golang.org/grpc@v1.32.0/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00028c1a0, 0xc000236a80, 0x157c218, 0xc000103c80, 0xc000126100)
    google.golang.org/grpc@v1.32.0/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

Error: The terraform-provider-ionoscloud_v6.0.0-beta.4 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.

Additional Notes

Tried also with terraform v0.15.0 same error Tried with older version of the provider v5.2.4, v5.2.0 Maybe smth change in the api?

iblindu commented 3 years ago

@arteonprifti please check v6.0.0-beta.5

arteonprifti commented 3 years ago

@IuliaBlindu it is working, thanks :)