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

vSphere provider: sparse VMDK is not completely cleaned up with vsphere_file #8058

Closed
sputnik13 opened this issue Aug 8, 2016 · 3 comments
Closed

Comments

@sputnik13
Copy link

sputnik13 commented Aug 8, 2016

When a sparse VMDK is uploaded with vsphere_file and used with a vsphere_virtual_machine, additional files get generated due to the VMDK being a sparse VMDK. If I have keep_on_remove = "true" on the VM so that terraform destroy can delete the vsphere_file, the additional files generated for the sparse VMDK is not cleaned up properly. This results in subsequent runs of terrform apply failing.

Sample terraform template below...

resource "vsphere_file" "k8s-master-bootdisk" {
    datacenter = "${var.datacenter}"
    datastore = "${var.datastore}"
    source_file = "${var.linux_vmdk_source}"
    destination_file = "${var.prefix}/master-bootdisk.vmdk"
}

resource "vsphere_virtual_machine" "k8s-master" {
    name = "${var.prefix}-master"
    #folder = "${vsphere_folder.k8s_folder.path}"
    datacenter = "${var.datacenter}"
    cluster = "${var.cluster}"

    connection {
        user = "ubuntu"
        key_file = "${var.key_file}"
    }

    network_interface {
        label = "${var.network}"
    }

    cdrom {
        datastore = "${var.datastore}"
        path = "${vsphere_file.cidata.destination_file}"
    }

    disk {
        controller_type = "ide"
        datastore = "${var.datastore}"
        vmdk = "${vsphere_file.k8s-master-bootdisk.destination_file}"
        bootable = "true"
        keep_on_remove = "true"
    }
}
@jbilbro
Copy link

jbilbro commented Aug 9, 2016

@sputnik13 Can you please tell me the value of the variable var.prefix? I'm trying to duplicate your issue and haven't tried vsphere_file before - I typically use a template. I can't tell how to discern the path from looking at documentation. Also, are you pointing this at a vcenter server or directly at a ESXi host?

@jbilbro
Copy link

jbilbro commented Aug 19, 2016

@sputnik13 ?

@ghost
Copy link

ghost commented Apr 10, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants