terraform-provider-vsphere: rpc error when changing existing VMs network_interface

Terraform Version

0.12.4

vSphere Provider Version

1.12.0

Affected Resource(s)

  • imported vsphere_virtual_machine

Terraform Configuration Files

provider "vsphere" {
  allow_unverified_ssl = true
  client_debug = true
}

data "vsphere_datacenter" "dc" {
  name = "dc_name"
}

data "vsphere_datastore_cluster" "datastore_cluster" {
  name          = "datastore_cluster_name"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "network" {
  name          = "network_name"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_virtual_machine" "vm_template" {
  name          = "gitlab-runner-coreos-2135.5.0"
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_virtual_machine" "devel-runners" {
  count = 2
  name                 = "machine${count.index + 1}"
  resource_pool_id     = "resgroup-50029"
  datastore_cluster_id = data.vsphere_datastore_cluster.datastore_cluster.id
  enable_logging = true
  folder = "devel-runner folder/"
  lifecycle {
    ignore_changes = ["custom_attributes", "imported", "clone"]
  }
  num_cpus = 2
  cpu_share_level = "custom"
  memory   = 12288
  memory_share_level = "custom"
  guest_id = data.vsphere_virtual_machine.vm_template.guest_id

  network_interface {
    network_id   = data.vsphere_network.network.id
    adapter_type = data.vsphere_virtual_machine.vm_template.network_interface_types[0]
  }

  disk {
    label = "disk0"
    size  = data.vsphere_virtual_machine.vm_template.disks[0].size
    keep_on_remove = true
  }

  clone {
    template_uuid = data.vsphere_virtual_machine.vm_template.id
  }

  vapp {
    properties = {
      "guestinfo.coreos.config.url" = "https://config.url/"
      "guestinfo.hostname"          = "machine${count.index + 1}"
    }
  }
}

Panic Output

https://gist.github.com/ol-metaswitch/44ac21c8e372c06005f2451ab15bc965

Expected Behavior

The changes to the network interface in the terraform apply to be made to the VM are made without error.

Actual Behavior

Upon accepting the changes to the network interface made by the terraform apply command Terraform crashed.

Steps to Reproduce

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

  1. Import existing VM with a different network_interface["network_id"] to the one stated into terraform state
  2. terraform apply
  3. Accept changes indicated from the apply
  4. Terraform crashes

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Isn’t that issue related to problems with using the lifecycle attributes as opposed to a network interface issue?

Or have I misunderstood the issue you’ve referenced @aareet ?