I tried adding the logic into a local copy of the module, but I could not get it work. I would get the following error
error processing disk changes post-clone: disk.1: error creating disk: ServerFaultCode: The object 'vim.Datastore:****' has already been deleted or has not been completely created Additionally, there was an error removing the cloned virtual machine: disk.1: cannot find disk device: disk UUID is missing
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
We are rebuilding our infra every sprint. We've found a need to keep some data on a VMDK that stays around.
We can do this if we create our own main.tf and following the disk syntax as outlined here vsphere_virtual_machine
disk { label = "data_disk" attach = true path = var.disk_paths[var.environment] datastore_id = data.vsphere_datastore.datastore.id unit_number = 1 }
I tried adding the logic into a local copy of the module, but I could not get it work. I would get the following error
error processing disk changes post-clone: disk.1: error creating disk: ServerFaultCode: The object 'vim.Datastore:****' has already been deleted or has not been completely created Additionally, there was an error removing the cloned virtual machine: disk.1: cannot find disk device: disk UUID is missing
// Additional disks defined by Terraform config dynamic "disk" { for_each = var.data_disk iterator = terraform_disks content { label = terraform_disks.key size = lookup(terraform_disks.value, "size_gb", null) unit_number = ( lookup( terraform_disks.value, "unit_number", -1 ) < 0 ? ( lookup( terraform_disks.value, "data_disk_scsi_controller", 0 ) > 0 ? ( (terraform_disks.value.data_disk_scsi_controller * 15) + index(keys(var.data_disk), terraform_disks.key) + (var.scsi_controller == tonumber(terraform_disks.value["data_disk_scsi_controller"]) ? local.template_disk_count : 0) ) : ( index(keys(var.data_disk), terraform_disks.key) + local.template_disk_count ) ) : ( tonumber(terraform_disks.value["unit_number"]) ) ) thin_provisioned = lookup(terraform_disks.value, "thin_provisioned", "true") eagerly_scrub = lookup(terraform_disks.value, "eagerly_scrub", "false") datastore_id = lookup(terraform_disks.value, "datastore_id", null) storage_policy_id = lookup(terraform_disks.value, "storage_policy_id", null) io_reservation = lookup(terraform_disks.value, "io_reservation", null) io_share_level = lookup(terraform_disks.value, "io_share_level", "normal") io_share_count = lookup(terraform_disks.value, "io_share_level", null) == "custom" ? lookup(terraform_disks.value, "io_share_count") : null disk_mode = lookup(terraform_disks.value, "disk_mode", null) keep_on_remove = lookup(terraform_disks.value, "keep_on_remove", "false") attach = lookup(terraform_disks.value, "attach", "false") path = lookup(terraform_disks.value, "path", null) }
Would it be possible to get attaching logic added to the module, or would somebody be able to point out where I messed up in trying to add it myself.
Thank you,