Terraform Provider – Cluster creation or update fails

Hey there, I tried creating a fresh cluster and updating an imported one. Both times the qovery terraform provider crashes.

Here is the error message:

qovery_cluster.####: Modifying... [id=####]
╷
│ 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.
╵

Stack trace from the terraform-provider-qovery_v0.7.0 plugin:

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

goroutine 59 [running]:
github.com/qovery/terraform-provider-qovery/qovery.convertResponseToCluster(_)
        github.com/qovery/terraform-provider-qovery/qovery/resource_cluster_model.go:140 +0x44
github.com/qovery/terraform-provider-qovery/qovery.clusterResource.Update({_}, {_, _}, {{{{0x104a38698, 0x140003b9800}, {0x104918260, 0x140003b87b0}}, {0x140002518f0, 0x0, 0x0, ...}}, ...}, ...)
        github.com/qovery/terraform-provider-qovery/qovery/resource_cluster.go:337 +0x1e8
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).UpdateResource(0x140002e1d40, {0x104a358f8, 0x140003b8030}, 0x1400053d418, 0x1400053d268)
        github.com/hashicorp/terraform-plugin-framework@v0.9.0/internal/fwserver/server_updateresource.go:90 +0x58c
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x104a358f8?, {0x104a358f8, 0x140003b8030}, 0x14000323050, 0x1400053d570)
        github.com/hashicorp/terraform-plugin-framework@v0.9.0/internal/fwserver/server_applyresourcechange.go:96 +0x13c
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0x140002e1d40, {0x104a35850?, 0x140004aad80?}, 0x14000575950)
        github.com/hashicorp/terraform-plugin-framework@v0.9.0/internal/proto6server/server_applyresourcechange.go:52 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x140002a1220, {0x104a358f8?, 0x14000385a10?}, 0x140001c2700)
        github.com/hashicorp/terraform-plugin-go@v0.9.1/tfprotov6/tf6server/server.go:810 +0x38c
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x1049f7a40?, 0x140002a1220}, {0x104a358f8, 0x14000385a10}, 0x1400013c720, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.9.1/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:385 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x140003788c0, {0x104a387f8, 0x140001024e0}, 0x14000329320, 0x140003f0000, 0x104f7cc60, 0x0)
        google.golang.org/grpc@v1.46.0/server.go:1283 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x140003788c0, {0x104a387f8, 0x140001024e0}, 0x14000329320, 0x0)
        google.golang.org/grpc@v1.46.0/server.go:1620 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.46.0/server.go:922 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.46.0/server.go:920 +0x298

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

Can someone help me out please :slight_smile: ?

Update: Got an email after 10minutes, that my cluster has been updated successfully.

Running terraform plan shows, that everything is alright.

Still not a good issue. Looks like the connection breaks.

Best,
Pierre

Indeed, it seems that the Terraform client crashed :confused: I will try on my side to see if it happened. I never had this issue before v0.7.0. It’s maybe a regression? I don’t know. I have to check.

However, did you succeed in making it works?

Like 10min after the Terraform client crashed I got an email by your system informing me, that my cluster has been deployed successfully.

Then I just imported the cluster via terraform import. That worked :+1:

Best,
Pierre

1 Like

I think it’s related to parsing the success response.

Here are the logs from the web console:

63
00:24:31
Create - Infrastructure 'V2 Cluster – AWS (####)' deployment is in progress...
2022-07-02T12:54:56.005416684Z
64
00:25:01
Create - Infrastructure 'V2 Cluster – AWS (####)' deployment is in progress...
2022-07-02T12:55:26.005880454Z
65
00:25:31
Created - Kubernetes cluster successfully created
2022-07-02T12:55:56.006317806Z

And “exactly” at that time the client crashed:

qovery_cluster.v2_cluster: Still creating... [25m30s elapsed]
qovery_cluster.v2_cluster: Still creating... [25m40s elapsed]
╷
│ 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.
╵

Stack trace from the terraform-provider-qovery_v0.7.0 plugin:

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

goroutine 12 [running]:
github.com/qovery/terraform-provider-qovery/qovery.convertResponseToCluster(_)
        github.com/qovery/terraform-provider-qovery/qovery/resource_cluster_model.go:140 +0x44
github.com/qovery/terraform-provider-qovery/qovery.clusterResource.Create({_}, {_, _}, {{{{0x103868698, 0x1400062c990}, {0x103748260, 0x1400048b860}}, {0x14000201ad0, 0x0, 0x0, ...}}, ...}, ...)
        github.com/qovery/terraform-provider-qovery/qovery/resource_cluster.go:285 +0x164

Hope that helps :slight_smile:

Best,
Pierre

Hi Peter, the v0.7.1 has been released and this issue has been fixed (I tried it yesterday). Can you confirm?

Thanks Romaric, I will test it later this day :slight_smile: !

Best,
Pierre

1 Like

The newest version 0.8.0 creates a cluster all the way through :slight_smile:

Thanks @rophilogene !

Best,
Pierre

1 Like