dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

when expanding the disk, the disk is recreated #1017

Open sergey-ostrovskiy opened 1 year ago

sergey-ostrovskiy commented 1 year ago

Hello

terraform version v1.4.5 provider version v0.7.1

I want to increase the disk, but at the same time the disk is recreated and the data from it is deleted.

Initially I use an empty disk and install the OS through pxe

Change disk size in resource libvirt_volume

what am I doing wrong?

Magnitus- commented 1 year ago

You are not doing anything wrong. The resource is configured to be recreated if the volume size change: https://github.com/dmacvicar/terraform-provider-libvirt/blob/main/libvirt/resource_libvirt_volume.go#L40

You have some options open to you to circumvent this:

Alternatively, you can:

But the last solution would definitely be working against the grain of what terraform and this provider does.