create data share directory when creating VM
This commit is contained in:
parent
308e572471
commit
cd94a85535
1 changed files with 18 additions and 0 deletions
18
main.tf
18
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
|
||||
]
|
||||
}
|
||||
|
|
Reference in a new issue