I'm working on some simple TF code to provision VMs on a host using libvirt/KVM. I'm using the dmacvicar/libvirt provider to do so. For whatever reason, even the most trivial code seems to be choked up the fact a storage pool doesn't exist yet. Here's an example:
```
resource "libvirt_pool" "company-vms" { name = "staging-primary" type = "dir" path = "/var/lib/libvirt/images/NFS/staging-primary" }
resource "libvirt_volume" "base-image-rhel9_base-150g" { name = "rhel9_base-150g.qcow2" pool = libvirt_pool.company-vms.name source = "https://<url_to_repostory>/rhel9_base-150g.qcow2" depends_on = [libvirt_pool.company-vms] } ```
If I run terraform plan
I get the following:
```
# libvirt_pool.company-vms will be created
+ resource "libvirt_pool" "company-vms" {
+ allocation = (known after apply)
+ available = (known after apply)
+ capacity = (known after apply)
+ id = (known after apply)
+ name = "staging-primary"
+ path = "/var/lib/libvirt/images/NFS/staging-primary"
+ type = "dir"
}
Plan: 2 to add, 0 to change, 0 to destroy. ╷ │ Error: error retrieving pool staging-primary for volume /var/lib/libvirt/images/NFS/staging-primary/rhel9_base-150g.qcow2: Storage pool not found: no storage pool with matching name 'staging-primary' │ │ with libvirt_volume.base-image-rhel9_base-150g, │ on make-vm.tf line 11, in resource "libvirt_volume" "base-image-rhel9_base-150g": │ 11: resource "libvirt_volume" "base-image-rhel9_base-150g" { │ ╵ ```
So what's happening? I always thought Terraform itself created the dependency tree and this seems like a trivial example. Am I wrong? Is there something in the provider itself that needs to be fixed in order to better suggest dependencies to terraform? I'm at a loss.
Less than $3,500? Press x to doubt. I just bought some of Samsung’s 32TB SAS SSDs for work. Not disclosing numbers but they were more than that.
Samsung just dropped a 61TB SSD, says it could make a 122TB drive.
DataHoarder