diff --git a/main.tf b/main.tf index 1808aad..51b0018 100644 --- a/main.tf +++ b/main.tf @@ -82,6 +82,20 @@ resource "libvirt_cloudinit_disk" "debian" { network_config = local.cloudinit_network_config } +resource "null_resource" "data_share" { + connection { + type = "ssh" + user = "root" + host = "atlas.hyp" + } + + provisioner "remote-exec" { + inline = [ + "${var.add_data_share} && mkdir --mode=og=rw /data/${local.domain_name}" + ] + } +} + resource "libvirt_domain" "debian" { name = local.domain_name memory = var.memory @@ -127,4 +141,8 @@ resource "libvirt_domain" "debian" { libvirt_cloudinit_disk.debian.id ] } + + depends_on = [ + null_resource.data_share + ] }