vmware / terraform-provider-vcd

Terraform VMware Cloud Director provider
https://www.terraform.io/docs/providers/vcd/
Mozilla Public License 2.0
148 stars 112 forks source link

help plz - error Creating OrgvDC for an already existing Organization #1335

Open GORO9991 opened 1 week ago

GORO9991 commented 1 week ago

hello, im new to Tf and whenever i try creating an OrgvDC for an existing Organization, im getting an error as per below: "Error: The terraform-provider-vcd_v3.10.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." below is a snippet of the main.tf containing the lines for this OrgvDC creation where everything looks straight forward:

resource "vcd_org_vdc" "vdc-name" { name = var.vdc_name org = var.org_name allocation_model = var.vdc_alloc_model provider_vdc_name = var.vdc_pvdc_name network_quota = 50 compute_capacity { cpu { limit = 0 } memory { limit = 0 } } storage_profile { name = var.vdc_storage_name enabled = true limit = 10240 default = true } enabled = true enable_thin_provisioning = true enable_fast_provisioning = true delete_force = true delete_recursive = true depends_on = [ vcd_org.org-name ] }

Any help is much appreciated Rgds

adambarreiro commented 1 week ago

Hi @GORO9991, could you provide the full log with the stacktrace from the output?

Also the VCD provider log would be useful (check how to enable here, with logging=true and logging_file)

Thanks!

GORO9991 commented 1 week ago

hello @adambarreiro and many thanks for your reply, the full output message is as follows: Error: Plugin did not respond │ │ with vcd_org_vdc.vdc-name, │ on main.tf line 61, in resource "vcd_org_vdc" "vdc-name": │ 61: resource "vcd_org_vdc" "vdc-name" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵

Stack trace from the terraform-provider-vcd_v3.10.0 plugin:

panic: assignment to entry in nil map

goroutine 45 [running]: github.com/vmware/go-vcloud-director/v2/govcd.(Client).cumulativeQueryWithHeaders(0xc000257b80, {0xff4a62, 0x19}, 0x4?, 0x0?, 0x0?) github.com/vmware/go-vcloud-director/v2@v2.21.0/govcd/query_metadata.go:251 +0x2f1 github.com/vmware/go-vcloud-director/v2/govcd.(Client).cumulativeQuery(...) github.com/vmware/go-vcloud-director/v2@v2.21.0/govcd/query_metadata.go:188 github.com/vmware/go-vcloud-director/v2/govcd.(VCDClient).QueryProviderVdcStorageProfileByName(0xc000257b80, {0xc000043600, 0x1c}, {0xc00025a180, 0x56}) github.com/vmware/go-vcloud-director/v2@v2.21.0/govcd/system.go:757 +0x11c github.com/vmware/terraform-provider-vcd/v3/vcd.getVcdVdcInput(0xc0004d5bd8?, 0xc00072a640) github.com/vmware/terraform-provider-vcd/v3/vcd/resource_vcd_org_vdc.go:1258 +0x137b github.com/vmware/terraform-provider-vcd/v3/vcd.resourceVcdVdcCreate({0x11a4458, 0xc0007193e0}, 0x0?, {0xfdab60?, 0xc00072a640}) github.com/vmware/terraform-provider-vcd/v3/vcd/resource_vcd_org_vdc.go:319 +0x505 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc000384380, {0x11a4490, 0xc0004a73e0}, 0xd?, {0xfdab60, 0xc00072a640}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:733 +0x12e github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc000384380, {0x11a4490, 0xc0004a73e0}, 0xc00009ca90, 0xc000238e00, {0xfdab60, 0xc00072a640}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:864 +0xa85 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc000015b30, {0x11a4490?, 0xc0004a72c0?}, 0xc000213d10) github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/grpc_provider.go:1024 +0xe8d github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc0002141e0, {0x11a4490?, 0xc0004a68d0?}, 0xc0008158f0) github.com/hashicorp/terraform-plugin-go@v0.16.0/tfprotov5/tf5server/server.go:821 +0x574 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xf99e00?, 0xc0002141e0}, {0x11a4490, 0xc0004a68d0}, 0xc000815880, 0x0) github.com/hashicorp/terraform-plugin-go@v0.16.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:422 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc0003441e0, {0x11a8be0, 0xc0001204e0}, 0xc0007edd40, 0xc0002031d0, 0x17a42a0, 0x0) google.golang.org/grpc@v1.56.0/server.go:1337 +0xdf0 google.golang.org/grpc.(Server).handleStream(0xc0003441e0, {0x11a8be0, 0xc0001204e0}, 0xc0007edd40, 0x0) google.golang.org/grpc@v1.56.0/server.go:1714 +0xa2f google.golang.org/grpc.(Server).serveStreams.func1.1() google.golang.org/grpc@v1.56.0/server.go:959 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.56.0/server.go:957 +0x18c

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

adambarreiro commented 2 days ago

I think it's the same issue reported here: https://github.com/vmware/terraform-provider-vcd/issues/1098, it was fixed in Provider v3.11.0.

I remember you mentioned you were using VCD 10.3, which v3.11.0 does not support. Any chances of upgrading VCD?

GORO9991 commented 2 days ago

thanks @adambarreiro for your reply definitely we re planning to upgrade vCD to newer version and it s on our planned activities for the coming days Thanks a lot