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

Can't edit existing virtual_machine resources after updating to v1.19.0 (Error: could not find SystemId) #1111

Closed
jschoewe opened this issue Jun 18, 2020 · 3 comments · Fixed by #1112
Labels
bug Type: Bug

Comments

@jschoewe
Copy link

jschoewe commented Jun 18, 2020

Terraform Version

v0.12.26

vSphere Provider Version

v1.19.0

Affected Resource(s)

  • vsphere_virtual_machine

Terraform Configuration Files

main.tf

# Configure the vSphere provider
provider "vsphere" {
  user           = var.vsphere_username
  password       = var.vsphere_password
  vsphere_server = var.vsphere_server

  # If you have a self-signed cert
  allow_unverified_ssl = true
}

# Get the vsphere datacenter
data "vsphere_datacenter" "dc" {
  name = var.vsphere_datacenter
}

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

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

data "vsphere_virtual_machine" "import_vm" {
  name          = var.vm_name
  datacenter_id = data.vsphere_datacenter.dc.id
}

# Define a resource to import an existing VM into
resource "vsphere_virtual_machine" "destroy_vm" {
  name = var.vm_name

  # NIC definition
  network_interface {
    network_id   = data.vsphere_network.network.id
    adapter_type = data.vsphere_virtual_machine.import_vm.network_interface_types[0]
  }

  guest_id  = data.vsphere_virtual_machine.import_vm.guest_id

  resource_pool_id = var.vsphere_resource_pool_id

  datastore_id = data.vsphere_datastore.datastore.id

  scsi_type = data.vsphere_virtual_machine.import_vm.scsi_type

  # Disk information
  dynamic "disk" {
    for_each = data.vsphere_virtual_machine.import_vm.disks

    content {
      label            = "disk${disk.key}"
      size             = disk.value.size
      eagerly_scrub    = disk.value.eagerly_scrub
      thin_provisioned = disk.value.thin_provisioned
      unit_number      = disk.key
    }
  }
}

variables.tf

# vSphere login credentials
variable "vsphere_server" {}
variable "vsphere_username" {}
variable "vsphere_password" {}

# vSphere datacenter name
variable "vsphere_datacenter" {}

# vSphere datastore name (must NOT be a datastore cluster)
variable "vsphere_datastore" {}

# vSphere vlan name
variable "vsphere_network" {}

# vSphere resource pool MOID
variable "vsphere_resource_pool_id" {}

# Name of the VM in vCenter
variable "vm_name" {}

Debug Output

terraform plan
https://gist.github.com/jschoewe/0b8762c1a5aec1e880840da6a97beed2

terraform apply
https://gist.github.com/jschoewe/2fc38c91eff511f8a89b85d0cf426d71

Expected Behavior

Running terraform plan succeeds, I expect terraform apply to succeed as well and change the keep_on_remove variable on disks to false

Actual Behavior

terraform apply fails with error:
Error: could not find SystemId

Steps to Reproduce

  1. Import a VM into a virtual_machine resource
  2. Run terraform plan
  3. Run terraform apply

Important Factoids

  • This still works as expected if I revert the provider version back to 1.18.3.
  • Creating new VMs still works as expected in version 1.19.0.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@jschoewe jschoewe added the bug Type: Bug label Jun 18, 2020
@bill-rich
Copy link
Contributor

Thanks for the report. I've looked into it and will have a bug fix ready for the release on Monday.

@mtaumike
Copy link

Ha! Right on, just this this issue this morning!

@ghost
Copy link

ghost commented Jul 19, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

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

Successfully merging a pull request may close this issue.

3 participants