resource "libvirt_domain" "domain" { count = var.node_count name = "swarm-${count.index + 1}" vcpu = var.node_vcpu memory = var.node_memory disk { volume_id = libvirt_volume.root[count.index].id } cloudinit = libvirt_cloudinit_disk.cidata[count.index].id console { type = "pty" target_port = "0" target_type = "serial" } console { type = "pty" target_type = "virtio" target_port = "1" } network_interface { bridge = "br0" } provisioner "remote-exec" { inline = [ "cloud-init status --wait", "sudo shutdown -r +0" ] connection { type = "ssh" user = "deploy" host = "swarm-${count.index + 1}" } } provisioner "remote-exec" { inline = [ "echo 'ready'", ] connection { type = "ssh" user = "deploy" host = "swarm-${count.index + 1}" } } }