terraform-provider-libvirt
terraform-provider-libvirt copied to clipboard
Create data sources for pre-existing libvirt network, pool, etc resources
System Information
Linux distribution
Ubuntu..
Terraform version
Terraform v1.3.5
on darwin_amd64
Provider and libvirt versions
./terraform-provider-libvirt_v0.7.0 -version
./terraform-provider-libvirt_v0.7.0 0.7.0
Libvirt 6.0.0 (Ubuntu 20.04.5 LTS)
Description of Issue/Question
The ability to pull in existing resources
via import exists. This is useful and good, until you have to destroy a component, or need to terminate a VM without destroying other resources that are managed elsewhere.
Ideally, I should be able to create a data source in the project:
For example, a volume...
data "libvirt_volume" "backing-volume" {
pool = "images"
name = "ubuntu-20.04-server.img"
}
The risk faced in importing the resources is that a careless terraform destroy
can wipe out a shared resource like a network or pool. I may have multiple systems relying on the same backing image, which are not all handled by the same terraform plan. Or, I may have another project in TF that manages available images on the source system directly, and want to reference the named versions directly instead of downloading them to the KVM host.
Draft PR is up.
https://github.com/dmacvicar/terraform-provider-libvirt/pull/987