civo/terraform-provider-civo

interface {} is nil error when scaling default node pool in kubernetes cluster

Confuzed opened this issue · 9 comments

I'm using terraform with your provider to manage a cluster, and have encountered an error during the apply stage whenever I try to change the number of nodes in the cluster's default node pool. Note that the configuration change does occur, but terraform doesn't recognise that and thinks the apply failed due to the error.

Output from terraform:

2022-05-05T17:04:30.938Z [ERROR] vertex "civo_kubernetes_cluster.my-cluster" error: Plugin did not respond

Stack trace from the terraform-provider-civo_v1.0.18 plugin:

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

goroutine 30 [running]:
github.com/civo/terraform-provider-civo/civo.waitForKubernetesNodePoolCreate(0xc00020a500, 0xc000282b80, 0x1, 0xc000091a00, 0xc00000a5a0)
	/home/runner/work/terraform-provider-civo/terraform-provider-civo/civo/resource_kubernetes_cluster_nodepool.go:369 +0x989
github.com/civo/terraform-provider-civo/civo.resourceKubernetesClusterUpdate(0x10d4e78, 0xc0005a4060, 0xc000282b80, 0xf31620, 0xc00020a500, 0xc0005a6700, 0x86c90a, 0xc000585080)
	/home/runner/work/terraform-provider-civo/terraform-provider-civo/civo/resource_kubernetes_cluster.go:449 +0x78a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc0004f6ee0, 0x10d4e08, 0xc000500a00, 0xc000282b80, 0xf31620, 0xc00020a500, 0x0, 0x0, 0x0)
	/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:364 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0004f6ee0, 0x10d4e08, 0xc000500a00, 0xc0002848c0, 0xc000585080, 0xf31620, 0xc00020a500, 0x0, 0x0, 0x0, ...)
	/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:464 +0x390
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00009d758, 0x10d4e08, 0xc000500a00, 0xc0007e8910, 0xc000500a00, 0xeef480, 0xc0007e7500)
	/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/grpc_provider.go:955 +0x8ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ApplyResourceChange(0xc0000c0780, 0x10d4eb0, 0xc000500a00, 0xc000284700, 0xc0000c0780, 0xc000762ba0, 0x46ca47)
	/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xeef480, 0xc0000c0780, 0x10d4eb0, 0xc0007e75c0, 0xc0000712c0, 0x0, 0x10d4eb0, 0xc0007e75c0, 0xc00029a000, 0x1f14)
	/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000353dc0, 0x10ddd58, 0xc000001500, 0xc000504700, 0xc0005c4600, 0x15e19c0, 0x0, 0x0, 0x0)
	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000353dc0, 0x10ddd58, 0xc000001500, 0xc000504700, 0x0)
	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0003701f0, 0xc000353dc0, 0x10ddd58, 0xc000001500, 0xc000504700)
	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

Error: The terraform-provider-civo_v1.0.18 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.

I have the same issue

Terraform Cloud Plan output

pools {
  update
    node_count : 1 change to 2
}

Terraform Cloud Apply output

Stack trace from the terraform-provider-civo_v1.0.18 plugin:

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

goroutine 54 [running]:
github.com/civo/terraform-provider-civo/civo.waitForKubernetesNodePoolCreate(0xc0006f2190, 0xc00070ea00, 0x1, 0xc0003192b0, 0xc00001c5a0)
/home/runner/work/terraform-provider-civo/terraform-provider-civo/civo/resource_kubernetes_cluster_nodepool.go:369 +0x989
github.com/civo/terraform-provider-civo/civo.resourceKubernetesClusterUpdate(0x10d4e78, 0xc000718f00, 0xc00070ea00, 0xf31620, 0xc0006f2190, 0xc0002b4a70, 0x86c90a, 0xc000612d60)
/home/runner/work/terraform-provider-civo/terraform-provider-civo/civo/resource_kubernetes_cluster.go:449 +0x78a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc00055aee0, 0x10d4e08, 0xc0000c3d00, 0xc00070ea00, 0xf31620, 0xc0006f2190, 0x0, 0x0, 0x0)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:364 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00055aee0, 0x10d4e08, 0xc0000c3d00, 0xc0000fe5b0, 0xc000612d60, 0xf31620, 0xc0006f2190, 0x0, 0x0, 0x0, ...)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/resource.go:464 +0x390
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0005941b0, 0x10d4e08, 0xc0000c3d00, 0xc0006f2640, 0xc0000c3d00, 0xeef480, 0xc000618500)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/grpc_provider.go:955 +0x8ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ApplyResourceChange(0xc0006125e0, 0x10d4eb0, 0xc0000c3d00, 0xc0000fe0e0, 0xc0006125e0, 0xc0006185a0, 0xc0005daba0)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xeef480, 0xc0006125e0, 0x10d4eb0, 0xc0006185a0, 0xc000718180, 0x0, 0x10d4eb0, 0xc0006185a0, 0xc00033e000, 0x1f6c)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003c7dc0, 0x10ddd58, 0xc000103500, 0xc000300100, 0xc00058e630, 0x15e19c0, 0x0, 0x0, 0x0)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0003c7dc0, 0x10ddd58, 0xc000103500, 0xc000300100, 0x0)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00061a020, 0xc0003c7dc0, 0x10ddd58, 0xc000103500, 0xc000300100)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

Error: The terraform-provider-civo_v1.0.18 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.

Using dashboard.civo.com works :|

Fun fact, the cluster scaled properly.. just my Terraform Cloud Run failed with above message

Hi @Xzelsius I will check this

@alejandrojnm I noticed that you marked this issue as complete. Is a fix included in a release yet? Thanks!

I will check this again, you still have the problem ???

I will check this again, you still have the problem ???

One of our users ran into a similar panic, but it looks like that was using v1.0.24 of terraform-provider-civo, so I'm not sure if it was fixed in a subsequent release?

@alejandrojnm hi, did you have a chance to look? I am still blocked from resizing my node pools from pulumi (which is using this code). thanks in advance.

Hi sorry for the delay in this issue, I will take a look today

For the record, I just received this error using v1.0.29 on Terraform Cloud:

Stack trace from the terraform-provider-civo_v1.0.29 plugin:

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

goroutine 50 [running]:
github.com/civo/terraform-provider-civo/civo.waitForKubernetesNodePoolCreate(0xc0002c3130?, 0xc00004b100)
/home/runner/work/terraform-provider-civo/terraform-provider-civo/civo/resource_kubernetes_cluster_nodepool.go:367 +0x79f
github.com/civo/terraform-provider-civo/civo.resourceKubernetesClusterUpdate({0xdbfc50, 0xc000386d80}, 0xc00004b100, {0xc828a0?, 0xc0002c3130})
/home/runner/work/terraform-provider-civo/terraform-provider-civo/civo/resource_kubernetes_cluster.go:449 +0xe05
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc0004897a0, {0xdbfc88, 0xc000184f00}, 0xd?, {0xc828a0, 0xc0002c3130})
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/resource.go:741 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0004897a0, {0xdbfc88, 0xc000184f00}, 0xc00049ca90, 0xc00004af80, {0xc828a0, 0xc0002c3130})
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/resource.go:847 +0x82c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00045c5e8, {0xdbfc88?, 0xc000184de0?}, 0xc0001a4730)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/grpc_provider.go:1021 +0xe3c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0002fe780, {0xdbfc88?, 0xc000184420?}, 0xc0005da150)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/tf5server/server.go:813 +0x4fc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xc567c0?, 0xc0002fe780}, {0xdbfc88, 0xc000184420}, 0xc0005da0e0, 0x0)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000003c0, {0xdc26b0, 0xc000102820}, 0xc000318360, 0xc0004982d0, 0x126b060, 0x0)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:1295 +0xb0b
google.golang.org/grpc.(*Server).handleStream(0xc0000003c0, {0xdc26b0, 0xc000102820}, 0xc000318360, 0x0)
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:1636 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:932 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.48.0/server.go:930 +0x28a

Error: The terraform-provider-civo_v1.0.29 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.

The node pool did successfully resize, just like previously reported.