harvester / harvester

Open source hyperconverged infrastructure (HCI) software
https://harvesterhci.io/
Apache License 2.0
3.84k stars 324 forks source link

[BUG] terraform destroy -auto-approve doesn't always clear all volumes #5489

Open irishgordo opened 7 months ago

irishgordo commented 7 months ago

Describe the bug sometimes a disk isn't erased with terraform destroy -auto-approve when one or more are associate with a vm

To Reproduce Steps to reproduce the behavior:

  1. build up some terraform with a vm and disks
  2. apply
  3. destroy with the -auto-approve

Expected behavior disks to be cleaned up and terraform to not error out

Environment

Workaround

brandboat commented 5 months ago

I encountered this before (https://github.com/harvester/harvester/issues/5573), there is an option called auto_delete, add this to the disk config and the volumes should be erased after execute terraform destroy -auto-approve

disk {
  name = "test-disk"
  size = "10Gi"
  image = "ubuntu"
  auto_delete = true
}