terraform-libvirt/stack/volumes.tf

27 lines
989 B
Terraform
Raw Normal View History

2020-07-28 21:45:32 +00:00
# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/volume.html.markdown
# -------- root disk use by compute --------
# ~> Tip: when provisioning multiple domains using the same base image, create a libvirt_volume for the base image and then define
# the domain specific ones as based on it. This way the image will not be modified and no extra disk space is going to be used for the base image.
2021-01-23 20:45:22 +00:00
resource "libvirt_volume" "root_centos" {
2020-07-28 21:45:32 +00:00
name = "my-root-centos"
pool = var.pool_1
base_volume_name = local.centos7_qcow2
2020-07-28 21:45:32 +00:00
}
2021-01-23 20:45:22 +00:00
resource "libvirt_volume" "root_debian" {
name = format("root-debian-%s", count.index)
pool = var.pool_1
base_volume_name = local.debian_buster_qcow2
count = local.number_domain
2020-07-28 21:45:32 +00:00
}
2021-01-23 20:45:22 +00:00
resource "libvirt_volume" "external_disk" {
name = format("external-disk-%s", count.index)
2020-07-28 21:45:32 +00:00
# 10Gb
2021-01-23 20:45:22 +00:00
size = 10737418240
pool = var.pool_1
count = local.number_domain
2020-07-28 21:45:32 +00:00
}