citrix / terraform-provider-citrix

Terraform Provider for Citrix
https://registry.terraform.io/providers/citrix/citrix/latest
Apache License 2.0
45 stars 5 forks source link

The terraform-provider-citrix_v0.3.1.exe plugin crashed! #13

Closed lahavana closed 10 months ago

lahavana commented 10 months ago

Hello,

tried to import an existing DaaS Azure Hypervisor hosting connection with "terraform import citrix_daas_hypervisor.azure-hypervisor " and the plugin crashes.

Here the output:

Stack trace from the terraform-provider-citrix_v0.3.1.exe plugin:

panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x8 pc=0x11a2fd0]

goroutine 6 [running]: github.com/citrix/citrix-daas-rest-go/client.RetryOperationWithExponentialBackOff(0xba5b6b4, 0xa, 0x3) github.com/citrix/citrix-daas-rest-go@v0.2.3/client/citrixdaas_client.go:157 +0xe0 github.com/citrix/citrix-daas-rest-go/client.(CitrixDaasClient).SignIn(0xbc40ac0) github.com/citrix/citrix-daas-rest-go@v0.2.3/client/auth.go:86 +0x706 github.com/citrix/citrix-daas-rest-go/client.NewCitrixDaasClient({0xbaa63c0, 0x32}, {0x0, 0x0}, {0xba98cb0, 0xc}, {0xbac0150, 0x24}, {0xbaae390, 0x18}, ...) github.com/citrix/citrix-daas-rest-go@v0.2.3/client/citrixdaas_client.go:71 +0x481 github.com/citrix/terraform-provider-citrix/internal/provider.(citrixProvider).Configure(0xb97e868, {0x1900444, 0xbc3f938}, {{0xba98ba4, 0x5}, {{{0x1902348, 0xbc3fc98}, {0x15f35e0, 0xbc3d3a0}}, {0x1902d00, ...}}}, ...) github.com/citrix/terraform-provider-citrix/internal/provider/provider.go:345 +0x150d github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(Server).ConfigureProvider(0xb8c4e00, {0x1900444, 0xbc3f938}, 0xbc3d2a0, 0xbc3d240) github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/fwserver/server_configureprovider.go:18 +0xb8 github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(Server).ConfigureProvider(0xb8c4e00, {0x1900444, 0xbc3f8d8}, 0xbc407f0)
github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/proto6server/server_configureprovider.go:39 +0x33e github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(server).ConfigureProvider(0xb8baeb0, {0x1900444, 0xbc3f698}, 0xbc3ce80) github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/tf6server/server.go:568 +0x2f7 github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ConfigureProvider_Handler({0x170f7a0, 0xb8baeb0}, {0x1900444, 0xbc3f698}, 0xbc48700, 0x0) github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:413 +0x18a google.golang.org/grpc.(Server).processUnaryRPC(0xb902780, {0x1900444, 0xb862e88}, {0x1902438, 0xb8c0900}, 0xbc18280, 0xb8ffd40, 0x22f23c8, 0x0)
google.golang.org/grpc@v1.59.0/server.go:1343 +0xf68 google.golang.org/grpc.(Server).handleStream(0xb902780, {0x1902438, 0xb8c0900}, 0xbc18280) google.golang.org/grpc@v1.59.0/server.go:1737 +0xd03 google.golang.org/grpc.(Server).serveStreams.func1.1() google.golang.org/grpc@v1.59.0/server.go:986 +0xa7 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.59.0/server.go:997 +0x16b

Kind regards,

AlanCitrix commented 10 months ago

Thanks we are working on a fix for the crash. The provider didn't get far enough, but your command terraform import citrix_daas_hypervisor.azure-hypervisor is missing a hypervisor ID to import.

lahavana commented 10 months ago

Thanks for the response! Yes, I forgot to copy the guid as I posted the issue. I tried to create resources too and the plug-in also crashed. Appreciate your work on the provider!

AlanCitrix commented 10 months ago

No problem. We think the crash might be because the machine you're running Terraform on cannot communicate with the DDC. Are you using an onprem DDC >=2308 or a Cloud DDC? Are you able to load Web Studio?

Our fix will give us a proper error message instead of a crash, but I don't think it will fix the underlying issue.

lahavana commented 10 months ago

I’m trying to create resources for Citrix cloud. Ok, I will try another environment/workstation tomorrow to sort that one out.

AlanCitrix commented 10 months ago

Can you try setting environment = "Production" in the provider configuration? It seems we are missing the default value.

https://registry.terraform.io/providers/citrix/citrix/latest/docs#environment

lahavana commented 10 months ago

That's it and now the import was successfull. You made my day! Not sure if it's a limit of a hosting connection but if I use for_each in combination with the resource citrix_daas_hypervisor_resource_pool, the provider crashes after 10 virtual networks. I'm adding 19 different azure virtual networks to the same hosting connection for an internal training environment.

AlanCitrix commented 10 months ago

What's the crash stack trace?

AlanCitrix commented 10 months ago

Version 0.3.2 was just released, it should have the fix so you don't have to specify the environment = "Production"

Can you try the 19 resource pools again on the new version, and open a new issue with the stack trace or error if it is still failing?

Thanks for trying it out!