Open alexs77 opened 9 months ago
It also seems to be impossible to override the wwn
with a random string. In the source code, I'm now setting it to a fixed value:
resource "libvirt_domain" "default" {
# …
disk {
volume_id = libvirt_volume.os.id
scsi = true
wwn = "2027eb2388d3f2e6"
}
# …
}
Runs of terraform apply -auto-approve && terraform apply -auto-approve
show that the value is not stored.
libvirt_pool.default: Refreshing state... [id=e7d1e51b-87a0-4b9d-b580-2fafe7473cd5]
random_string.disk_os_wwn: Refreshing state... [id=2027eb2388d3f2e6]
libvirt_volume.default: Refreshing state... [id=/var/lib/libvirt/images/example/ubuntu.qcow2]
libvirt_volume.data[1]: Refreshing state... [id=/var/lib/libvirt/images/example/data_1.qcow2]
libvirt_volume.data[2]: Refreshing state... [id=/var/lib/libvirt/images/example/data_2.qcow2]
libvirt_volume.data[0]: Refreshing state... [id=/var/lib/libvirt/images/example/data_0.qcow2]
libvirt_volume.os: Refreshing state... [id=/var/lib/libvirt/images/example/example_os.qcow2]
random_string.disks_data_wwn[2]: Refreshing state... [id=0442395cc370fb38]
random_string.disks_data_wwn[1]: Refreshing state... [id=c44f1979e5109b54]
random_string.disks_data_wwn[0]: Refreshing state... [id=8e1b7db0d61e170c]
libvirt_domain.default: Refreshing state... [id=411e8833-9574-4c9e-94dd-c05371c9deb2]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# libvirt_domain.default will be updated in-place
~ resource "libvirt_domain" "default" {
id = "411e8833-9574-4c9e-94dd-c05371c9deb2"
name = "example"
# (11 unchanged attributes hidden)
~ disk {
~ wwn = "05abcdf8df2189e9" -> "2027eb2388d3f2e6"
# (2 unchanged attributes hidden)
}
# (2 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
libvirt_domain.default: Modifying... [id=411e8833-9574-4c9e-94dd-c05371c9deb2]
libvirt_domain.default: Modifications complete after 0s [id=411e8833-9574-4c9e-94dd-c05371c9deb2]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
libvirt_pool.default: Refreshing state... [id=e7d1e51b-87a0-4b9d-b580-2fafe7473cd5]
random_string.disk_os_wwn: Refreshing state... [id=2027eb2388d3f2e6]
libvirt_volume.default: Refreshing state... [id=/var/lib/libvirt/images/example/ubuntu.qcow2]
libvirt_volume.data[2]: Refreshing state... [id=/var/lib/libvirt/images/example/data_2.qcow2]
libvirt_volume.data[1]: Refreshing state... [id=/var/lib/libvirt/images/example/data_1.qcow2]
libvirt_volume.data[0]: Refreshing state... [id=/var/lib/libvirt/images/example/data_0.qcow2]
libvirt_volume.os: Refreshing state... [id=/var/lib/libvirt/images/example/example_os.qcow2]
random_string.disks_data_wwn[0]: Refreshing state... [id=8e1b7db0d61e170c]
random_string.disks_data_wwn[1]: Refreshing state... [id=c44f1979e5109b54]
random_string.disks_data_wwn[2]: Refreshing state... [id=0442395cc370fb38]
libvirt_domain.default: Refreshing state... [id=411e8833-9574-4c9e-94dd-c05371c9deb2]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# libvirt_domain.default will be updated in-place
~ resource "libvirt_domain" "default" {
id = "411e8833-9574-4c9e-94dd-c05371c9deb2"
name = "example"
# (11 unchanged attributes hidden)
~ disk {
~ wwn = "05abcdf8df2189e9" -> "2027eb2388d3f2e6"
# (2 unchanged attributes hidden)
}
# (2 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
libvirt_domain.default: Modifying... [id=411e8833-9574-4c9e-94dd-c05371c9deb2]
libvirt_domain.default: Modifications complete after 1s [id=411e8833-9574-4c9e-94dd-c05371c9deb2]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
As you can see, the wwn
stays at 05abcdf8df2189e9
.
Confirming this seems to be happening to me as well. On Ubuntu 20.04
.
System Information
Linux distribution
Red Hat Enterprise Linux release 8.8 (Ootpa)
Terraform version
Provider and libvirt versions
Checklist
[ ] Is your issue/contribution related with enabling some setting/option exposed by libvirt that the plugin does not yet support, or requires changing/extending the provider terraform schema?
[X] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:
Description of Issue/Question
Setup
Steps to Reproduce Issue
terraform apply -auto-approve && terraform apply -auto-approve
As can be seen there, the
wwn
attribute of the resourcelibvirt_domain.default
=>disk { … }
would be reset for every run. This results in constant changes.If
libvirt_domain.default.disk.scsi
is set tofalse
, the issue does not surface.Additional information:
Do you have SELinux or Apparmor/Firewall enabled? Some special configuration? Have you tried to reproduce the issue without them enabled?
n/a