Unable to destroy VM on vSphere: disk.0: virtual disk "data": virtual disks cannot be shrunk (old: 40 new: 30)

Hello guys, this period I’m using terraform for creating virtual machines ( with disk_size_vm > disk_size_template) from a template (with 30 GiB of disk size in default ). When I launch the terraform destroy or even terraform plan -destroy -out destroy_plan && terraform apply destroy_plan , the vm cannot be deleted and the error is like this :

Error: disk.0: virtual disk “data”: virtual disks cannot be shrunk (old: 40 new: 30)

│ with vsphere_virtual_machine.vm,
│ on main.tf line 42, in resource “vsphere_virtual_machine” “vm”:
│ 42: resource “vsphere_virtual_machine” “vm” {

For instance, the server that I’m using has the version v1.13 of terraform, and when I tested my terraform project in another server with v0.14 it worked and the vm have been destroyed.
So, in this case we can say that the terraform version is the reason of the error, but I can’t have the right explanation behind this, because if terraform going to destroy a vm with a specific disk size, why is it required that the vm disk size needs to match the disk size of the template to do the destruction of the vm?

Does anyone know the explanation or the solution please!!

There’s no such version of Terraform. The latest release series is v1.4.

Since the error is coming from deep in complicated code in terraform-provider-vsphere, it might be better to raise the problem in their issue tracker. It seems like it is applying validation in a case where it should not.

It appears someone else has recently tried to raise the same issue at Can't destroy r/vsphere_virtual_machine due to changed disk options · Issue #1873 · hashicorp/terraform-provider-vsphere · GitHub but it got closed as a result of a misunderstanding about exactly what was being reported - you might want to provide more information there and seek to get it reopened.

this what I have as version !
Thank you for your reply!