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

Mark disk wwn and nvram arguments as computed #1064

Closed wfdewith closed 3 months ago

wfdewith commented 5 months ago

These changes are meant to keep the libvirt provider idempotent, i.e. running terraform apply twice with no changes in between should not result in any updated resources.

The disk WWN is randomly generated if it is not specified, which means that the disk.wwn argument will always be different when it is regenerated. This difference causes Terraform to perform an in-place update.

When specifying the firmware argument, libvirt will automatically generate the corresponding NVRAM definitions. Since the generated definitions differ from the unspecified nvram argument in the resource and the nvram argument is marked as force new, Terraform will replace the entire libvirt domain.

The nvram.file argument was required, but this is not necessary for libvirt. Libvirt will autogenerate the location of the NVRAM variables file even if only the template is specified.

dmacvicar commented 3 months ago

Thanks for the contribution.