Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected EOF when running example template #411

Closed
rsdcastro opened this issue Feb 24, 2018 · 9 comments · Fixed by #414
Closed

unexpected EOF when running example template #411

rsdcastro opened this issue Feb 24, 2018 · 9 comments · Fixed by #414
Labels
bug Type: Bug crash Impact: Crash

Comments

@rsdcastro
Copy link

Terraform Version

Terraform v0.11.3

  • provider.vsphere v1.3.2

vSphere Provider Version

$ terraform providers
.
└── provider.vsphere

Affected Resource(s)

  • vsphere_virtual_machine

Terraform Configuration Files

Based on template from https://www.terraform.io/docs/providers/vsphere/index.html

provider "vsphere" {
  user           = "<user>"
  password       = "<password>"
  vsphere_server = "<ip>"

  # if you have a self-signed cert
  allow_unverified_ssl = true

  client_debug = true
}

data "vsphere_datacenter" "dc" {
  name = "Cloud-DC"
}

data "vsphere_datastore" "datastore" {
  name          = "datastore1"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_resource_pool" "pool" {
  name          = "Cluster-1/Resources"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_network" "network" {
  name          = "VM Network"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

resource "vsphere_virtual_machine" "vm" {
  name             = "terraform-test"
  resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"

  num_cpus = 2
  memory   = 1024
  guest_id = "other3xLinux64Guest"

  network_interface {
    network_id = "${data.vsphere_network.network.id}"
  }

  disk {
    label = "disk0"
    size  = 20
  }
}

Crash Output

Error: Error applying plan:

1 error(s) occurred:

* vsphere_virtual_machine.vm: 1 error(s) occurred:

* vsphere_virtual_machine.vm: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


panic: runtime error: invalid memory address or nil pointer dereference
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf79f13]
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: goroutine 193 [running]:
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/inter$
al/helper/computeresource.DefaultDevicesFromReference(0xc42053a070, 0xc4205bc220, 0x16, 0xc4205a5390, 0xa, 0xc420014fe0, 0x13, 0x0, 0x0, 0x0, ...)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terrafor$
-providers/terraform-provider-vsphere/vsphere/internal/helper/computeresource/compute_resource_helper.go:146 +0x1c3
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/inter$
al/helper/resourcepool.DefaultDevices(0xc42053a070, 0xc420302040, 0xc420014fe0, 0x13, 0xc4202db0f0, 0xc42049f540, 0xc, 0xc42050d4b4, 0xa)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terrafor$
-providers/terraform-provider-vsphere/vsphere/internal/helper/resourcepool/resource_pool_helper.go:116 +0x229
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resou$
ceVSphereVirtualMachineCreateBare(0xc4205ba3f0, 0x1206180, 0xc42016cf40, 0x11760e0, 0xc420143c00, 0x0)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terrafor$
-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:674 +0x971
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resou$
ceVSphereVirtualMachineCreate(0xc4205ba3f0, 0x1206180, 0xc42016cf40, 0x24, 0x20f8160)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/[37/1849]
-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:219 +0x4af
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.
com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc42014a690, 0xc42007a140, 0xc420143800, 0x1206180, 0xc42016cf40, 0x1, 0xc42058c2a0, 0xc420068de0
)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform
-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:227 +0x364
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.
com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc42014ad90, 0xc42007a050, 0xc42007a140, 0xc420143800, 0x7f5c5c67c640, 0x0, 0x18)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform
-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0xa4
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.
com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc4201429e0, 0xc420142780, 0xc4202da240, 0x0, 0x0)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform
-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: reflect.Value.call(0xc4200688a0, 0xc42018c070, 0x13, 0x148d15f, 0x4, 0xc
42027bf20, 0x3, 0x3, 0x403a23, 0xc42053c000, ...)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /usr/local/go/src/reflect/value.go:434 +0x905
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: reflect.Value.Call(0xc4200688a0, 0xc42018c070, 0x13, 0xc42003ef20, 0x3,
0x3, 0xc42003ef20, 0xc42003ef28, 0xc420354080)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /usr/local/go/src/reflect/value.go:302 +0xa4
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: net/rpc.(*service).call(0xc420558140, 0xc42055e050, 0xc42036a1b8, 0xc420
376000, 0xc420143300, 0x11237e0, 0xc420142780, 0x16, 0x1123820, 0xc4202da240, ...)
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /usr/local/go/src/net/rpc/server.go:381 +0x142
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: created by net/rpc.(*Server).ServeCodec
2018-02-23T16:29:13.043-0800 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:       /usr/local/go/src/net/rpc/server.go:475 +0x36b
2018/02/23 16:29:13 [TRACE] root: eval: *terraform.EvalWriteState
2018/02/23 16:29:13 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2018/02/23 16:29:13 [TRACE] root: eval: *terraform.EvalIf
2018/02/23 16:29:13 [TRACE] root: eval: *terraform.EvalWriteState
2018-02-23T16:29:13.046-0800 [DEBUG] plugin: plugin process exited: path=/usr/local/google/home/rdc/go/src/k8s.io/kube-deploy/cluster-api-gcp/cloud/terraf
orm/templates/vmware/.terraform/plugins/linux_amd64/terraform-provider-vsphere_v1.3.2_x4
2018/02/23 16:29:13 [TRACE] root: eval: *terraform.EvalWriteDiff
2018/02/23 16:29:13 [TRACE] root: eval: *terraform.EvalApplyPost
2018/02/23 16:29:13 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* vsphere_virtual_machine.vm: unexpected EOF
2018/02/23 16:29:13 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* vsphere_virtual_machine.vm: unexpected EOF
2018/02/23 16:29:13 [TRACE] [walkApply] Exiting eval tree: vsphere_virtual_machine.vm
2018/02/23 16:29:13 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/02/23 16:29:13 [TRACE] dag/walk: upstream errored, not walking "provider.vsphere (close)"
2018/02/23 16:29:13 [TRACE] dag/walk: upstream errored, not walking "root"
2018/02/23 16:29:13 [TRACE] Preserving existing state lineage "e64226d1-582d-4051-acfb-f7cff06660bb"
2018/02/23 16:29:13 [TRACE] Preserving existing state lineage "e64226d1-582d-4051-acfb-f7cff06660bb"
2018/02/23 16:29:13 [TRACE] Preserving existing state lineage "e64226d1-582d-4051-acfb-f7cff06660bb"
2018/02/23 16:29:13 [TRACE] Preserving existing state lineage "e64226d1-582d-4051-acfb-f7cff06660bb"
2018/02/23 16:29:13 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-02-23T16:29:13.056-0800 [WARN ] plugin: error closing client during Kill: err="connection is shut down"



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Expected Behavior

Crashed

Actual Behavior

I would have expected the VM creation or some better error message.

Steps to Reproduce

  1. terraform apply .
@ghost ghost added bug Type: Bug crash Impact: Crash labels Feb 24, 2018
@rsdcastro
Copy link
Author

I also tried with the end-to-end example below, and it failed with the same error.

https://github.com/terraform-providers/terraform-provider-vsphere/tree/master/examples/end-to-end

@rsdcastro
Copy link
Author

I tried with the code from head and it failed with the same error as well.

@vancluever
Copy link
Contributor

Hey @rsdcastro, can you look at #409 and tell me if a similar scenario may apply to you? Specifically, do you happen to be running an expired vCenter, an unlicensed host that has an expired evaluation, or a free edition of ESXi?

Let me know!

@rsdcastro
Copy link
Author

@vancluever Chris - our license is valid, but it's for VMware Essentials. Is that the reason it's crashing?

Would you be able to advise on which license we might need?

@rsdcastro
Copy link
Author

rsdcastro commented Feb 26, 2018

govc works, using same URL, name and password.

$ govc vm.create -debug=true -dc=Cloud-DC -g=ubuntu64Guest -net="VM Network" -host=<IP> rdc-test-vm
$ govc vm.info -dc=Cloud-DC rdc-test-vm
Name:           rdc-test-vm
  Path:         /Cloud-DC/vm/rdc-test-vm
  UUID:         <UUID>
  Guest name:   Ubuntu Linux (64-bit)
  Memory:       1024MB
  CPU:          1 vCPU(s)
  Power state:  poweredOn
  Boot time:    2018-02-26 19:16:02.942146 +0000 UTC
  IP address:
  Host:         <IP>

@vancluever
Copy link
Contributor

Hey @rsdcastro, thanks for working with me on the VMware slack today. Just wanted to follow up and put this in an issue that the code seems to be failing around a similar point as #409 (example: here) which indicates a lack of an environmentBrowser property in the appropriate ComputeResource object. The odd thing being this property actually exists for you. So there's some disconnect happening here.

What I wanted you to try is to run the following against the appropriate ComputeResource:

govc object.collect /PATH/TO/YOUR/HOST environmentBrowser

This will dump the property from the MO directly. This will confirm that not only is it there but govc can read it, meaning that there is something going on in the code that we may need to account for.

Thanks!

@vancluever
Copy link
Contributor

So just as an update - after working with @rsdcastro on this one it appears that the environmentBrowser property can be nil on clusters with no hosts. This means that there could be legitimate cases where this can be nil that don't necessarily comprise scenarios where a license has expired.

I think what we will need to do is guard against this by doing a nil check on this property before attempting to load the environment browser from the cluster/host in question. The error message will be indicative of possible nature of the errors (licensing, and lack of permissions or hosts).

In the meantime, anyone else hitting this issue should check that this scenario or the scenario mentioned in #409 doesn't apply to them.

Thanks!

@rsdcastro
Copy link
Author

I can confirm that moving host to cluster gets me past this issue.

vancluever added a commit that referenced this issue Feb 27, 2018
The virtual machine resource relies on the cluster or standalone host
it's deployed on for information regarding a default hardware set or
guest OS family information. This is obtained via the EnvironmentBrowser
MO referenced by the respective cluster or host's ComputeResource MO.

There are certain situations where this attribute will be missing, two
of which have been identified so far via bug reports:

* A cluster without hosts will not contain an environment browser.
* vSphere licensing issues may cause a missing environment browser (#409
reported an expired vCenter).

This update wraps our fetching of the environment browser by the two
current compute resource helpers that utilize it in a helper that
validates that we actually have an environment browser before proceeding
to load it up, issuing an error alluding to the above if it is missing.

Fixes #411.
May also correct #409.
@rsdcastro
Copy link
Author

Thank you for the fix and all the help, Chris. Much appreciated.

@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug crash Impact: Crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants