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

Fix #35: Validated the terraform configuration #114

Merged
merged 4 commits into from
May 17, 2020
Merged

Conversation

PacoDw
Copy link
Contributor

@PacoDw PacoDw commented Apr 13, 2020

Added:

  • Test case to verify if the terraform configuration works fine.

I tried to recreate the issue with the following configuration:

data "nutanix_clusters" "clusters" {}

locals {
  cluster1 = "${data.nutanix_clusters.clusters.entities.0.service_list.0 == "PRISM_CENTRAL"
  ? data.nutanix_clusters.clusters.entities.1.metadata.uuid : data.nutanix_clusters.clusters.entities.0.metadata.uuid}"
}

resource "nutanix_image" "cirros-034-disk" {
  name        = "test-image-dou-vm-create-%[1]d"
  source_uri  = "http://packages.oit.ncsu.edu/centos/7.7.1908/isos/x86_64/CentOS-7-x86_64-NetInstall-1908.iso"
  description = "heres a tiny linux image, not an iso, but a real disk!"
}

resource "nutanix_virtual_machine" "vm1" {
  name                 = "test-dou-%[1]d-vm1"
  num_vcpus_per_socket = 1
  num_sockets          = 1
  memory_size_mib      = 186
  cluster_uuid         = "${local.cluster1}"


  disk_list {
    data_source_reference = {
      kind = "image"
      uuid = nutanix_image.cirros-034-disk.id
    }

    device_properties {
      disk_address = {
        device_index = 0
        adapter_type = "IDE"
      }
      device_type = "CDROM"
    }
  }
  disk_list {
    disk_size_mib = 100
  }
  disk_list {
    disk_size_mib = 200
  }
  disk_list {
    disk_size_mib = 300
  }
}

data "nutanix_virtual_machine" "vmds" {
  vm_id = "${nutanix_virtual_machine.vm1.id}"
}

resource "nutanix_virtual_machine" "vm2" {
  name                 = "test-dou-%[1]d-vm2"
  num_vcpus_per_socket = 1
  num_sockets          = 1
  memory_size_mib      = 186
  cluster_uuid         = "${local.cluster1}"


  disk_list {
    data_source_reference = {
      kind = "image"
      uuid = "${data.nutanix_virtual_machine.vmds.disk_list.0.data_source_reference.uuid}"
    }
  }
}

I didn't have any errrors, but if you think I ommited somthing in the configuration or you have a comment/concern just let me know.

closes #35

@PacoDw PacoDw requested a review from marinsalinas April 23, 2020 16:56
@marinsalinas marinsalinas merged commit b78ab7e into master May 17, 2020
@marinsalinas marinsalinas deleted the fix-#35 branch May 17, 2020 17:45
yannickstruyf3 pushed a commit to yannickstruyf3/terraform-provider-nutanix that referenced this pull request Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloning from a VM on AHV
2 participants