Skip to content

Commit

Permalink
fix: r/vsphere_virtual_disk with lazy forces replacement (#2033)
Browse files Browse the repository at this point in the history
Ref: #1824

Signed-off-by: Vasil Atanasov <[email protected]>
  • Loading branch information
vasilsatanasov authored Oct 10, 2023
1 parent 55898fa commit dde2002
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vsphere/resource_vsphere_virtual_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ func resourceVSphereVirtualDiskRead(d *schema.ResourceData, meta interface{}) er
Path: vDisk.vmdkPath,
}
diskType, err := virtualdisk.QueryDiskType(client, dp.String(), dc)
/**
Thick Provisioned Lazy Zeroed disk type a.k.a "lazy" in the provider context is actually
"preallocated" for the VC. Due to historical reasons i.e. the disk type is documented as "lazy".
In order to fix https://github.com/hashicorp/terraform-provider-vsphere/issues/1824 the value must be converted,
otherwise the disk is recreated
*/
if diskType == "preallocated" {
diskType = "lazy"
}

if err != nil {
return errors.New("Failed to query disk type")
}
Expand Down

0 comments on commit dde2002

Please sign in to comment.