josenk / terraform-provider-esxi

Terraform-provider-esxi plugin
GNU General Public License v3.0
538 stars 154 forks source link

Plugin crashed when using URL pointing to ESXi data store image #182

Closed wicadmin closed 1 year ago

wicadmin commented 2 years ago

Setting the ovf to esxi data store url causes the plugin to crash. Trying to use the same format I use in ovftool to point to the image already downloaded to the datastore:

variable "ovf_source" {
 default = "https://192.168.5.70/folder/ubuntu-21.04-server-cloudimg-amd64.ova?dcPath=ha-datacenter&dsName=datastore1"
}

The above URL works in a browser.

esxi_guest.Default: Creating...
╷
│ Error: Request cancelled
│ 
│   with esxi_guest.Default,
│   on main.tf line 41, in resource "esxi_guest" "Default":
│   41: resource "esxi_guest" "Default" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-esxi_v1.10.2 plugin:

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

goroutine 97 [running]:
github.com/josenk/terraform-provider-esxi/esxi.guestCREATE(0xc00057e410, 0xc000036bc0, 0xd, 0xc000036ba0, 0xa, 0xc000468070, 0x6f, 0x1492fb8, 0x1, 0xc000036c18, ...)
    github.com/josenk/terraform-provider-esxi/esxi/guest-create.go:211 +0x1e45
github.com/josenk/terraform-provider-esxi/esxi.resourceGUESTCreate(0xc00037e930, 0xd96900, 0xc00057e410, 0x2, 0x152de40)
    github.com/josenk/terraform-provider-esxi/esxi/resource_guest.go:403 +0x1ace
github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc000210b00, 0xc00057eb40, 0xc0005fa8c0, 0xd96900, 0xc00057e410, 0xda4f01, 0xc0000a6b78, 0xc000256960)
    github.com/hashicorp/terraform@v0.12.2/helper/schema/resource.go:286 +0x375
github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc000210e00, 0xc0001638d8, 0xc00057eb40, 0xc0005fa8c0, 0xc00023db88, 0xc00020a7c8, 0xda6f20)
    github.com/hashicorp/terraform@v0.12.2/helper/schema/provider.go:285 +0x99
github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00020a4e8, 0x101a310, 0xc00001a150, 0xc000114ae0, 0xc00020a4e8, 0xc00001a150, 0xc0005e4a50)
    github.com/hashicorp/terraform@v0.12.2/helper/plugin/grpc_provider.go:851 +0x88b
github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0xe7bc20, 0xc00020a4e8, 0x101a310, 0xc00001a150, 0xc00057e870, 0x0, 0x101a310, 0xc00001a150, 0xc0001a5600, 0x1b00)
    github.com/hashicorp/terraform@v0.12.2/internal/tfplugin5/tfplugin5.pb.go:3217 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000102f00, 0x1021f18, 0xc0003ff200, 0xc00046b100, 0xc00050afc0, 0x14ef2a0, 0x0, 0x0, 0x0)
    google.golang.org/grpc@v1.18.0/server.go:966 +0x486
google.golang.org/grpc.(*Server).handleStream(0xc000102f00, 0x1021f18, 0xc0003ff200, 0xc00046b100, 0x0)
    google.golang.org/grpc@v1.18.0/server.go:1245 +0xcbd
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000126170, 0xc000102f00, 0x1021f18, 0xc0003ff200, 0xc00046b100)
    google.golang.org/grpc@v1.18.0/server.go:685 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.18.0/server.go:683 +0xa5

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

If I use this, it works:

variable "ovf_source" {
 default = "https://cloud-images.ubuntu.com/releases/hirsute/release/ubuntu-21.04-server-cloudimg-amd64.ova"
}
josenk commented 2 years ago

I'm wondering if the ovf_source needs to be url encoded. Can you try with this string and let me know if it works.

https://192.168.5.70/folder/ubuntu-21.04-server-cloudimg-amd64.ova%3FdcPath%3Dha-datacenter%26dsName%3Ddatastore1"
wicadmin commented 2 years ago

I'm wondering if the ovf_source needs to be url encoded. Can you try with this string and let me know if it works.

https://192.168.5.70/folder/ubuntu-21.04-server-cloudimg-amd64.ova%3FdcPath%3Dha-datacenter%26dsName%3Ddatastore1"

Same error.

helixmediaservices commented 2 years ago

I am encountering this same error as well:

ovf_source = "https://192.168.1.41/folder/WINSRV2K19-TMP/WINSRV2K19-TMP.ovf?dcPath=ha-datacenter&dsName=HMS-VM-STORAGE-01"

Error: Plugin did not respond │ │ with esxi_guest.vmtest, │ on main.tf line 13, in resource "esxi_guest" "vmtest": │ 13: resource "esxi_guest" "vmtest" { │ │ 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-esxi_v1.10.2.exe plugin:

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

goroutine 45 [running]: github.com/josenk/terraform-provider-esxi/esxi.guestCREATE(0xc0001d7f90, 0xc0004a0600, 0xb, 0xc0004a4288, 0x11, 0xc00005c2a0, 0x6b, 0x1cb7158, 0x1, 0x0, ...) github.com/josenk/terraform-provider-esxi/esxi/guest-create.go:211 +0x27d8 github.com/josenk/terraform-provider-esxi/esxi.resourceGUESTCreate(0xc00040a620, 0x15b05c0, 0xc0001d7f90, 0x2, 0x1d672a0) github.com/josenk/terraform-provider-esxi/esxi/resource_guest.go:403 +0x1aee github.com/hashicorp/terraform/helper/schema.(Resource).Apply(0xc000098a80, 0xc0004c2aa0, 0xc00033cbc0, 0x15b05c0, 0xc0001d7f90, 0x15be801, 0xc0001221d8, 0xc00021a4b0) github.com/hashicorp/terraform@v0.12.2/helper/schema/resource.go:286 +0x395 github.com/hashicorp/terraform/helper/schema.(Provider).Apply(0xc000098d80, 0xc0001158d8, 0xc0004c2aa0, 0xc00033cbc0, 0xc00016c628, 0xc0000c00f8, 0x15c07c0) github.com/hashicorp/terraform@v0.12.2/helper/schema/provider.go:285 +0xa5 github.com/hashicorp/terraform/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0xc00008e4e0, 0x1837230, 0xc0004a3ce0, 0xc0004de9c0, 0xc00008e4e0, 0xc0004a3ce0, 0xc000523a50) github.com/hashicorp/terraform@v0.12.2/helper/plugin/grpc_provider.go:851 +0x88b github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1695480, 0xc00008e4e0, 0x1837230, 0xc0004a3ce0, 0xc0004c27d0, 0x0, 0x1837230, 0xc0004a3ce0, 0xc000402d80, 0x466) github.com/hashicorp/terraform@v0.12.2/internal/tfplugin5/tfplugin5.pb.go:3217 +0x222 google.golang.org/grpc.(Server).processUnaryRPC(0xc00004f500, 0x183f5d8, 0xc00004fe00, 0xc00011a100, 0xc000504ff0, 0x1d131c0, 0x0, 0x0, 0x0) google.golang.org/grpc@v1.18.0/server.go:966 +0x493 google.golang.org/grpc.(Server).handleStream(0xc00004f500, 0x183f5d8, 0xc00004fe00, 0xc00011a100, 0x0) google.golang.org/grpc@v1.18.0/server.go:1245 +0xcbd google.golang.org/grpc.(Server).serveStreams.func1.1(0xc00020e180, 0xc00004f500, 0x183f5d8, 0xc00004fe00, 0xc00011a100) google.golang.org/grpc@v1.18.0/server.go:685 +0xb2 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.18.0/server.go:683 +0xa8

Error: The terraform-provider-esxi_v1.10.2.exe plugin crashed!

josenk commented 2 years ago

Enable Debugging. export TF_LOG=DEBUG. In the debug output, you should be able to find the ovf_tool command... Try running it manually...

Question for both examples... Is this vSphere?

wicadmin commented 2 years ago

ok, this is ESXi free.

josenk commented 1 year ago

abandoned