=== G4-v7 throwaway exercise, 2026-07-19 ===
=== STEP 1: create (tofu apply -auto-approve, throwaway root) ===
OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
OpenTofu will perform the following actions:
# libvirt_cloudinit_disk.seed will be created
+ resource "libvirt_cloudinit_disk" "seed" {
+ id = (known after apply)
+ meta_data = <<-EOT
instance-id: throwaway-v7
local-hostname: throwaway-v7
EOT
+ name = "throwaway-v7-cloudinit"
+ path = (known after apply)
+ size = (known after apply)
+ user_data = <<-EOT
#cloud-config
hostname: throwaway-v7
EOT
}
# libvirt_domain.vm will be created
+ resource "libvirt_domain" "vm" {
+ devices = {
+ disks = [
+ {
+ driver = {
+ type = "qcow2"
}
+ source = {
+ volume = {
+ pool = "throwaway-v7-pool"
+ volume = "throwaway-v7-disk.qcow2"
}
}
+ target = {
+ bus = "virtio"
+ dev = "vda"
}
},
+ {
+ device = "cdrom"
+ source = {
+ volume = {
+ pool = "throwaway-v7-pool"
+ volume = "throwaway-v7-cloudinit.iso"
}
}
+ target = {
+ bus = "sata"
+ dev = "sda"
}
},
]
}
+ features = {
+ acpi = true
+ apic = {}
}
+ id = (known after apply)
+ memory = 256
+ memory_unit = "MiB"
+ name = "throwaway-v7-domain"
+ os = {
+ type = "hvm"
+ type_arch = "x86_64"
+ type_machine = "q35"
}
+ running = true
+ type = "kvm"
+ uuid = (known after apply)
+ vcpu = 1
}
# libvirt_pool.scratch will be created
+ resource "libvirt_pool" "scratch" {
+ allocation = (known after apply)
+ available = (known after apply)
+ capacity = (known after apply)
+ id = (known after apply)
+ name = "throwaway-v7-pool"
+ target = {
+ path = "/var/lib/libvirt/vr1/throwaway-v7"
}
+ type = "dir"
+ uuid = (known after apply)
}
# libvirt_volume.disk will be created
+ resource "libvirt_volume" "disk" {
+ allocation = (known after apply)
+ capacity = 104857600
+ id = (known after apply)
+ key = (known after apply)
+ name = "throwaway-v7-disk.qcow2"
+ path = (known after apply)
+ physical = (known after apply)
+ pool = "throwaway-v7-pool"
+ target = {
+ format = {
+ type = "qcow2"
}
+ path = (known after apply)
}
}
# libvirt_volume.seed will be created
+ resource "libvirt_volume" "seed" {
+ allocation = (known after apply)
+ capacity = (known after apply)
+ create = {
+ content = {
+ url = (known after apply)
}
}
+ id = (known after apply)
+ key = (known after apply)
+ name = "throwaway-v7-cloudinit.iso"
+ path = (known after apply)
+ physical = (known after apply)
+ pool = "throwaway-v7-pool"
}
Plan: 5 to add, 0 to change, 0 to destroy.
libvirt_cloudinit_disk.seed: Creating...
libvirt_cloudinit_disk.seed: Creation complete after 0s [id=c78933fb4b72fe38]
libvirt_pool.scratch: Creating...
libvirt_pool.scratch: Creation complete after 0s [id=7e9fef28-f7dc-4922-8631-5f6d2c31df9b]
libvirt_volume.seed: Creating...
libvirt_volume.disk: Creating...
libvirt_volume.seed: Creation complete after 0s [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso]
libvirt_volume.disk: Creation complete after 0s [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-disk.qcow2]
libvirt_domain.vm: Creating...
libvirt_domain.vm: Creation complete after 1s [name=throwaway-v7-domain]
Apply complete! Resources: 5 added, 0 changed, 0 destroyed.
=== STEP 2: pre-replace live state (virsh) ===
running
3
Name Path
--------------------------------------------------------------------------------------------
throwaway-v7-cloudinit.iso /var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso
throwaway-v7-disk.qcow2 /var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-disk.qcow2
staging ISO(s):
total 116
drwxr-xr-x 2 jessea123 jessea123 4096 Jul 19 08:04 .
drwxrwxrwt 41 root root 65536 Jul 19 08:04 ..
-rw-r--r-- 1 jessea123 jessea123 43008 Jul 19 08:04 cloudinit-c78933fb4b72fe38.iso
=== STEP 3: simulate host-reboot loss of the staging ISO ===
$ rm /tmp/terraform-provider-libvirt-cloudinit/cloudinit-c78933fb4b72fe38.iso
removed
=== STEP 4: re-plan after ISO loss (expect forced replacement) ===
libvirt_cloudinit_disk.seed: Refreshing state... [id=c78933fb4b72fe38]
libvirt_pool.scratch: Refreshing state... [id=7e9fef28-f7dc-4922-8631-5f6d2c31df9b]
libvirt_volume.seed: Refreshing state... [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso]
libvirt_volume.disk: Refreshing state... [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-disk.qcow2]
libvirt_domain.vm: Refreshing state... [name=throwaway-v7-domain]
Note: Objects have changed outside of OpenTofu
OpenTofu detected the following changes made outside of OpenTofu since the
last "tofu apply" which may have affected this plan:
# libvirt_cloudinit_disk.seed has been deleted
- resource "libvirt_cloudinit_disk" "seed" {
id = "c78933fb4b72fe38"
name = "throwaway-v7-cloudinit"
- path = "/tmp/terraform-provider-libvirt-cloudinit/cloudinit-c78933fb4b72fe38.iso" -> null
# (3 unchanged attributes hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.
─────────────────────────────────────────────────────────────────────────────
OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
-/+ destroy and then create replacement
OpenTofu will perform the following actions:
# libvirt_cloudinit_disk.seed will be created
+ resource "libvirt_cloudinit_disk" "seed" {
+ id = (known after apply)
+ meta_data = <<-EOT
instance-id: throwaway-v7
local-hostname: throwaway-v7
EOT
+ name = "throwaway-v7-cloudinit"
+ path = (known after apply)
+ size = (known after apply)
+ user_data = <<-EOT
#cloud-config
hostname: throwaway-v7
EOT
}
# libvirt_volume.seed must be replaced
-/+ resource "libvirt_volume" "seed" {
~ allocation = 45056 -> (known after apply)
~ capacity = 43008 -> (known after apply)
~ create = { # forces replacement
~ content = {
~ url = "/tmp/terraform-provider-libvirt-cloudinit/cloudinit-c78933fb4b72fe38.iso" -> (known after apply)
}
}
~ id = "/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso" -> (known after apply)
~ key = "/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso" -> (known after apply)
name = "throwaway-v7-cloudinit.iso"
~ path = "/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso" -> (known after apply)
~ physical = 43008 -> (known after apply)
# (1 unchanged attribute hidden)
}
Plan: 2 to add, 0 to change, 1 to destroy.
─────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so OpenTofu can't
guarantee to take exactly these actions if you run "tofu apply" now.
=== STEP 5: apply the replacement UNDER the running domain ===
domid before: 3
libvirt_cloudinit_disk.seed: Refreshing state... [id=c78933fb4b72fe38]
libvirt_pool.scratch: Refreshing state... [id=7e9fef28-f7dc-4922-8631-5f6d2c31df9b]
libvirt_volume.seed: Refreshing state... [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso]
libvirt_volume.disk: Refreshing state... [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-disk.qcow2]
libvirt_domain.vm: Refreshing state... [name=throwaway-v7-domain]
Note: Objects have changed outside of OpenTofu
OpenTofu detected the following changes made outside of OpenTofu since the
last "tofu apply" which may have affected this plan:
# libvirt_cloudinit_disk.seed has been deleted
- resource "libvirt_cloudinit_disk" "seed" {
id = "c78933fb4b72fe38"
name = "throwaway-v7-cloudinit"
- path = "/tmp/terraform-provider-libvirt-cloudinit/cloudinit-c78933fb4b72fe38.iso" -> null
# (3 unchanged attributes hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.
─────────────────────────────────────────────────────────────────────────────
OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
-/+ destroy and then create replacement
OpenTofu will perform the following actions:
# libvirt_cloudinit_disk.seed will be created
+ resource "libvirt_cloudinit_disk" "seed" {
+ id = (known after apply)
+ meta_data = <<-EOT
instance-id: throwaway-v7
local-hostname: throwaway-v7
EOT
+ name = "throwaway-v7-cloudinit"
+ path = (known after apply)
+ size = (known after apply)
+ user_data = <<-EOT
#cloud-config
hostname: throwaway-v7
EOT
}
# libvirt_volume.seed must be replaced
-/+ resource "libvirt_volume" "seed" {
~ allocation = 45056 -> (known after apply)
~ capacity = 43008 -> (known after apply)
~ create = { # forces replacement
~ content = {
~ url = "/tmp/terraform-provider-libvirt-cloudinit/cloudinit-c78933fb4b72fe38.iso" -> (known after apply)
}
}
~ id = "/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso" -> (known after apply)
~ key = "/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso" -> (known after apply)
name = "throwaway-v7-cloudinit.iso"
~ path = "/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso" -> (known after apply)
~ physical = 43008 -> (known after apply)
# (1 unchanged attribute hidden)
}
Plan: 2 to add, 0 to change, 1 to destroy.
libvirt_volume.seed: Destroying... [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso]
libvirt_volume.seed: Destruction complete after 0s
libvirt_cloudinit_disk.seed: Creating...
libvirt_cloudinit_disk.seed: Creation complete after 0s [id=c78933fb4b72fe38]
libvirt_volume.seed: Creating...
libvirt_volume.seed: Creation complete after 0s [id=/var/lib/libvirt/vr1/throwaway-v7/throwaway-v7-cloudinit.iso]
Apply complete! Resources: 2 added, 0 changed, 1 destroyed.
rc=0
domid after: 3
domstate after: running
=== STEP 6: teardown (tofu destroy) + zero-residue verification ===
libvirt_volume.seed: Destruction complete after 0s
libvirt_volume.disk: Destruction complete after 0s
libvirt_cloudinit_disk.seed: Destroying... [id=c78933fb4b72fe38]
libvirt_cloudinit_disk.seed: Destruction complete after 0s
libvirt_pool.scratch: Destroying... [id=7e9fef28-f7dc-4922-8631-5f6d2c31df9b]
libvirt_pool.scratch: Destruction complete after 0s
Destroy complete! Resources: 5 destroyed.
rc=0
--- residue checks ---
domains: 0
pools: 0
dir: ls: cannot access '/var/lib/libvirt/vr1/throwaway-v7': No such file or directory
staging: