# VMWare virtual disk label drift between terraform & vSphere

**URL:** <https://discuss.hashicorp.com/t/vmware-virtual-disk-label-drift-between-terraform-vsphere/73211>\
**Category:** Terraform Providers\
**Tags:** vsphere\
**Created:** [February 13, 2025, 9:53am UTC](https://discuss.hashicorp.com/t/vmware-virtual-disk-label-drift-between-terraform-vsphere/73211 "2025-02-13T09:53:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![degrootea](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/degrootea/32/44812_2.png) [@degrootea](https://discuss.hashicorp.com/u/degrootea)\
**Post date:** [February 13, 2025, 9:53am UTC](https://discuss.hashicorp.com/t/vmware-virtual-disk-label-drift-between-terraform-vsphere/73211/1 "2025-02-13T09:53:50Z")

</div>

Hi everyone!

When managing disks using the vmware vsphere terraform provider, a label is required.  
it seems the label you provide to the vmware vsphere provider can drift from the label used by VMWare.

For example:

Terraform:

```auto
resource "vsphere_virtual_machine" "vm" {
...
    
    dynamic "disk" {
        for_each = each.value.disks
        content {
            label = disk.value.label
            size = disk.value.size_gb
            unit_number = disk.value.controller_location
        }
    }

```

If a VM has 3 disks labeled:

- Hard disk 1
- Hard disk 2
- Hard disk 3

And I remove Hard disk 2 through Terraform, the Terraform state will remember:

- Hard disk 1
- Hard disk 3

But the vSphere API & UI seem to shuffle the disks to:

- Hard disk 1
- Hard disk 2

Renaming labels in Terraform to match the actual labels used by VMware triggers the disks to be deleted and recreated.

**Am I missing something? Is there a way to work around this?**

Any feedback or suggestions would be greatly appreciated!
