# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r terraform { required_version = ">= 0.12" required_providers { null = "~> 2.1" template = "~> 2.1" libvirt = ">= 0.0.0" } } provider "libvirt" { uri = "qemu+tcp://127.0.0.1/system" # uri = "qemu+ssh://root@192.168.100.10/system" } data "template_file" "user_data" { template = "${file("${path.module}/cloud_init.cfg")}" } # Use CloudInit to add the instance resource "libvirt_cloudinit_disk" "commoninit" { name = "commoninit.iso" pool = "default" user_data = data.template_file.user_data.rendered } resource "null_resource" "delay_10s" { provisioner "local-exec" { command = "sleep 10" } triggers = { "before" = libvirt_domain.db1.id } } # Output Server IP output "ip" { value = libvirt_domain.db1.network_interface depends_on = [null_resource.delay_10s] }