Docs
Using Terraform to manage KVM (libvirt) virtual machines
Based on this document and others.
Add your user to the libvirt group sudo usermod -aG libvirt [ username ] Create project mkdir -p ~/terraform/kvm/ubuntu/{config,images,templates} cd ~/terraform/kvm/ubuntu Create terraform main.tf cat <<EOF > main.tf terraform { required_providers { libvirt = { source = "dmacvicar/libvirt" } } } terraform { required_version = ">= 0.12" } EOF Create terraform outputs.tf cat <<EOF > outputs.tf output "ips" { # show IP, run 'terraform refresh' if not populated value = libvirt_domain.