nutanix / terraform-provider-nutanix

Terraform Nutanix Provider
https://www.terraform.io/docs/providers/nutanix/
Mozilla Public License 2.0
101 stars 112 forks source link

Cloning from a VM on AHV #35

Closed JonKohler closed 4 years ago

JonKohler commented 5 years ago

Moving issue from old repo, here: https://github.com/nutanix/terraform-provider-nutanix/issues/224

I am getting the following error while trying to clone from a VM

data.nutanix_virtual_machine.vmds: 1 error(s) occurred:

Here is the terraform tf

data "nutanix_virtual_machine" "vmds" {
  #vm_id = "${data.vault_generic_secret.nutanixuuid.data["centosce7"]}"
  vm_id = "41e97c71-52b3-458a-8ca5-e0ea50b613dd" #you should set your vmID here
}

resource "nutanix_virtual_machine" "demo-01-web" {
  # General Information
  name                 = "demo-01-web"
  description          = "demo Frontend Web Server"
  num_vcpus_per_socket = 2
  num_sockets          = 1
  memory_size_mib      = 4096
  #power_state          = "ON"

  # What cluster will this VLAN live on?
  cluster_reference = {
    kind = "cluster"
    uuid = "${local.cluster1}"
  }

  # What networks will this be attached to?
  nic_list = [{
    # subnet_reference is saying, which VLAN/network do you want to attach here?
    subnet_reference = {
      kind = "subnet"
      uuid = "4b170678-3e31-408d-b825-65403041a51d"
    }

  #   ip_endpoint_list = {
  #     ip   = "${local.ip_haproxy}"
  #     type = "ASSIGNED"
  #   }
  }]

  # What disk/cdrom configuration will this have?
  disk_list = [{
    # data_source_reference in the Nutanix API refers to where the source for
    # the disk device will come from. Could be a clone of a different VM or a
    # image like we're doing here
    data_source_reference = [{
      kind = "image"
      uuid = "${data.nutanix_virtual_machine.vmds.disk_list.0.data_source_reference.uuid}"
    }]

    # defining an additional entry in the disk_list array will create another
    # disk in addition to the image we're showing off above.
  #  device_properties = [{
  #    device_type = "DISK"
  #  }]
  #  disk_size_mib = 5000
  }]
}

Expected behavior A clear and concise description of what you expected to happen.

Logs If you've got any logs/outputs, attach them

Versions (please complete the following information):

justinhauer commented 4 years ago

@JonKohler were you ever able to resolve this issue? I am looking to clone an existing VM for use in my terraform code and would like to know if you did anything to get past the issue you had.

JonKohler commented 4 years ago

Hey Justin - sorry I didn't see this before, I haven't done anything with this issue as I'm not plugged into the terraform project any longer. ill ping the team internally

PacoDw commented 4 years ago

Hello, I tested with the latest Nutanix version, and I didn't have any errors, also I added a test case to verify it, you can see it on the PR #114

Let me know if you have another comment or concern, thank you so much.

marinsalinas commented 4 years ago

@justinhauer, this configuration was tested on the latest version of this provider (master) and seems to be fixed, this fix will be available in the next release, you can test it building the provider binary from the master, feel free to open a new issue if you are still having issues. Thanks for your collaboration :)