hashicorp / terraform-provider-vsphere

Terraform Provider for VMware vSphere
https://registry.terraform.io/providers/hashicorp/vsphere/
Mozilla Public License 2.0
612 stars 449 forks source link

Deploy Cisco Firepower Management Center cause Terraform crash #413

Closed Koleon closed 6 years ago

Koleon commented 6 years ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue trackers reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.11.3
+ provider.vsphere v1.3.2

vSphere Provider Version

.
├── provider.terraform
└── provider.vsphere ~> 1.3.0

Affected Resource(s)

resource "vsphere_virtual_machine" "FMCv" {
  count            = "${terraform.workspace == "default" ? 0 : 1}"
  name             = "${local.machine_prefix}-FMCv"
  resource_pool_id = "${local.pool_name}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"
  folder           = "${local.srv_folder}"
  guest_id         = "${data.vsphere_virtual_machine.FMCv.guest_id}"
  scsi_type        = "${data.vsphere_virtual_machine.FMCv.scsi_type}"
  network_interface {
    network_id = "${local.srv_interface}"
  }
  network_interface {
    network_id = "${data.vsphere_network.mgmt.id}"
  }
  disk {
    label            = "disk0"
    size             = "${data.vsphere_virtual_machine.FMCv.disks.0.size}"
    eagerly_scrub    = "${data.vsphere_virtual_machine.FMCv.disks.0.eagerly_scrub}"
    thin_provisioned = "${data.vsphere_virtual_machine.FMCv.disks.0.thin_provisioned}"
  }
  clone {
    template_uuid = "${data.vsphere_virtual_machine.FMCv.id}"
    customize {
      timeout = "${var.timeout}"
      linux_options {
        host_name = "${local.machine_prefix}-fmcv"
        domain    = "cycz.test"
      }
      network_interface {
        ipv4_address = "${local.srv_ip_prefix}.2"
        ipv4_netmask = 24
      }
      network_interface {
        ipv4_address = "${local.mgmt_ip_prefix}.22"
        ipv4_netmask = 18
      }
      ipv4_gateway   = "${local.srv_ip_prefix}.1"
    }
  }
}
data "vsphere_virtual_machine" "FMCv" {
  name          = "Cisco_Firepower_Management_Center"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

This issue affects only the one resource.

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

Debug Output

Please provide a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

Terraform should deploy Cisco VM.

Actual Behavior

Terraform crash with following error:

panic: runtime error: invalid memory address or nil pointer dereference
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf90c66]
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: 
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: goroutine 914 [running]:
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice.(*CdromSubresource).Read(0xc420740320, 0xc420448500, 0xe, 0x10, 0x0, 0x0)
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go:448 +0x3c6
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice.CdromPostCloneOperation(0xc4203087e0, 0xc4201621e0, 0xc420448500, 0xe, 0x10, 0x4, 0xc42059f340, 0x3, 0x4, 0x3, ...)
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go:301 +0x644
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineCreateClone(0xc4203087e0, 0x1206180, 0xc420659070, 0x11760e0, 0xc420708800, 0x0)
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:781 +0xd3c
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineCreate(0xc4203087e0, 0x1206180, 0xc420659070, 0xc4203087e0, 0x0)
2018-02-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:217 +0x1f4
2018-02-27T09:36:29.897+0100 [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(0xc42040ec40, 0xc4203e6410, 0xc420708440, 0x1206180, 0xc420659070, 0x1, 0xc42048c150, 0xc42052c120)
2018-02-27T09:36:29.897+0100 [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-27T09:36:29.897+0100 [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(0xc42040f340, 0xc4203e6320, 0xc4203e6410, 0xc420708440, 0x7fc96f241000, 0x0, 0x18)
2018-02-27T09:36:29.897+0100 [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-27T09:36:29.897+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc4207c05e0, 0xc420708020, 0xc4202ae310, 0x0, 0x0)
2018-02-27T09:36:29.898+0100 [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-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: reflect.Value.call(0xc4203e8fc0, 0xc420740000, 0x13, 0x148d15f, 0x4, 0xc420045f20, 0x3, 0x3, 0x0, 0x0, ...)
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /usr/local/go/src/reflect/value.go:434 +0x905
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: reflect.Value.Call(0xc4203e8fc0, 0xc420740000, 0x13, 0xc420577720, 0x3, 0x3, 0xc420561f20, 0x0, 0xc42028fb40)
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /usr/local/go/src/reflect/value.go:302 +0xa4
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: net/rpc.(*service).call(0xc4203c4100, 0xc4204520a0, 0xc420608120, 0xc420646180, 0xc4207c0b20, 0x11237e0, 0xc420708020, 0x16, 0x1123820, 0xc4202ae310, ...)
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /usr/local/go/src/net/rpc/server.go:381 +0x142
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4: created by net/rpc.(*Server).ServeCodec
2018-02-27T09:36:29.898+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.3.2_x4:   /usr/local/go/src/net/rpc/server.go:475 +0x36b
2018/02/27 09:36:29 [TRACE] root: eval: *terraform.EvalWriteState
2018-02-27T09:36:29.899+0100 [DEBUG] plugin: plugin process exited: path=/home/koleon/git/LAB/terraform-cycz/.terraform/plugins/linux_amd64/terraform-provider-vsphere_v1.3.2_x4
2018/02/27 09:36:29 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2018/02/27 09:36:29 [TRACE] root: eval: *terraform.EvalIf
2018/02/27 09:36:29 [TRACE] root: eval: *terraform.EvalWriteState
2018/02/27 09:36:29 [TRACE] root: eval: *terraform.EvalWriteDiff
2018/02/27 09:36:29 [TRACE] root: eval: *terraform.EvalApplyPost
2018/02/27 09:36:29 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* vsphere_virtual_machine.FMCv: unexpected EOF
2018/02/27 09:36:29 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* vsphere_virtual_machine.FMCv: unexpected EOF
2018/02/27 09:36:29 [TRACE] [walkApply] Exiting eval tree: vsphere_virtual_machine.FMCv
2018/02/27 09:36:29 [TRACE] dag/walk: upstream errored, not walking "provider.vsphere (close)"
2018/02/27 09:36:29 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/02/27 09:36:29 [TRACE] dag/walk: upstream errored, not walking "root"
2018/02/27 09:36:29 [TRACE] Preserving existing state lineage "7e7bfe58-68ff-4512-a08e-509017c92e9e"
2018/02/27 09:36:29 [TRACE] Preserving existing state lineage "7e7bfe58-68ff-4512-a08e-509017c92e9e"
2018/02/27 09:36:29 [TRACE] Preserving existing state lineage "7e7bfe58-68ff-4512-a08e-509017c92e9e"
2018/02/27 09:36:29 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-02-27T09:36:29.926+0100 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Consul used as tf backend. Nothing atypical.

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? Not yet.

jodysimpson commented 6 years ago

I ran into this issue using Ubuntu 16.04 cloud image. I created a VM, changed some settings on the machine and then converted back to a template. Terraform crashed while trying to create VM from this modified template. It turned out it was the OVF environment being loaded as an ISO and the Terraform vSphere provider trying to access the CD/Drive afterwards.

My pull request fixes the issue. In the meantime, you can turn the template into a VM and remove the ISO from the CD/Drive, then convert back to a template to resolve the issue.

vancluever commented 6 years ago

Hey all, 1.4.0 should be out soon which fixes this issue. If you continue to have the issue after the release (should be a few hours), please submit a new issue with the new crash data.

Thanks!