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

v1.16.0 - vsphere_virtual_machine : Invalid operation for device '0' #965

Closed
dstoffel-de opened this issue Feb 4, 2020 · 7 comments
Closed
Labels
bug Type: Bug

Comments

@dstoffel-de
Copy link

Hi,

Since the release 1.16.0 of the terraform-provider-vsphere, we are unable to create new virtual machine. (works with older release)

vsphere_virtual_machine.svvm: Creating...
vsphere_virtual_machine.svvm: Still creating... [10s elapsed]
Error: error reconfiguring virtual machine: error reconfiguring virtual machine: Invalid operation for device '0'.

Let me know if you need more information (govmomi log?)

Terraform Version

Terraform v0.12.20

  • provider.vsphere v1.16.0

vSphere Provider Version

.
└── provider.vsphere
( provider.vsphere v1.16.0)

Affected Resource(s)

Please list the resources as a list, for example:

  • vsphere_virtual_machine

Terraform Configuration Files

variable "dns_servers" {}
variable "domain" {}
variable "vsphere_datacenter" {}
variable "vsphere_cluster" {}
variable "vsphere_datastore" {}
variable "vsphere_template" {}
variable "vsphere_folder" {}
variable "vsphere_network" {}

data "vsphere_datacenter" "datacenter" {
        name = var.vsphere_datacenter
}

data "vsphere_resource_pool" "cluster" {
        name = "${var.vsphere_cluster}/Resources"
        datacenter_id = data.vsphere_datacenter.datacenter.id
}

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

data "vsphere_virtual_machine" "template" {
        name          = var.vsphere_template
        datacenter_id = data.vsphere_datacenter.datacenter.id
}

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

resource "vsphere_virtual_machine" "svvm" {
        name             = "testvm5"
        folder           = ""
        num_cpus         = 1
        memory           = 1024

        memory_hot_add_enabled = true
        cpu_hot_add_enabled    = true
        cpu_hot_remove_enabled = true

        datastore_id     = data.vsphere_datastore.datastore.id
        resource_pool_id = data.vsphere_resource_pool.cluster.id
        guest_id         = data.vsphere_virtual_machine.template.guest_id
        scsi_type        = data.vsphere_virtual_machine.template.scsi_type

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

        disk {
                label            = "disk0"
                size             = data.vsphere_virtual_machine.template.disks.0.size
                eagerly_scrub    = data.vsphere_virtual_machine.template.disks.0.eagerly_scrub
                thin_provisioned = data.vsphere_virtual_machine.template.disks.0.thin_provisioned
        }
        clone {
                template_uuid = data.vsphere_virtual_machine.template.id
                customize {
                        timeout = 30
                        linux_options {
                          host_name = "testvm"
                          domain = "vm.lab.platform-essential.com"
                        }
                }
        }
}

Debug Output

https://gist.github.com/dstoffel-de/0ca6f1173974a8d969f65b40696eb0c6

Expected Behavior

What should have happened?

VM created

Actual Behavior

What actually happened?

Error during cloning

Steps to Reproduce

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

  1. terraform apply
@aareet aareet added the bug Type: Bug label Feb 4, 2020
@bill-rich
Copy link
Contributor

Hi @dstoffel-de!

I believe this is related to #966, but seems to be a different manifestation.

I'm working on tracking down the potential causes of this issue. There are a few data points I could use that would help make sure I cover all the cases.

  1. What vCenter/vSphere version are you using?
  2. Does the user Terraform is running as have "Profile-driven storage" permissions at the vCenter level?

Thanks, and I'll provide updates shortly.

@dstoffel-de
Copy link
Author

Hello @bill-rich ,

  1. What vCenter/vSphere version are you using?
    Version 6.7.0 (Build 14070654)

  2. Does the user Terraform is running as have "Profile-driven storage" permissions at the vCenter level?

The terraform's user have the Administrator role at the Global Permissions level. (access control -> global permission)

Let me know if you need something else.

Thanks !
Davy

@bill-rich
Copy link
Contributor

I believe I have a fix ready for this. I'm running acceptance tests now to confirm. The problem was with how the storage policy was being looked up for VMs. The VM's template's storage policy was being checked on each read. Thanks for helping track this down!

@bill-rich
Copy link
Contributor

I'm going to close this out since I believe it is fixed in v1.16.1. Please let me know if I'm mistaken and I'll get the issue reopened.

@dstoffel-de
Copy link
Author

dstoffel-de commented Feb 12, 2020

Hello @bill-rich

Same issue with v1.16.1 (i don't think it's related to the permission but i can be wrong).

Terraform v0.12.20

  • provider.vsphere v1.16.1

Let me know what i can share (according to the SOAP call, this error is returned after the ReconfigVM_Task)

https://gist.github.com/dstoffel-de/7ae3c6a26c97ea58c3723c6233857b25

Thank you,
Davy

@claudex
Copy link

claudex commented Mar 25, 2020

The issue is still there with the latests version:

Terraform v0.12.24

  • provider.vsphere v1.17.0

@ghost
Copy link

ghost commented Apr 18, 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 Apr 18, 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

No branches or pull requests

4 participants