# base-image: one downloaded cloud image, shared (via backing_store
# copy-on-write in modules/cloudinit-vm) across every VM that boots from it.
# Downloaded ONCE per image, not per-VM -- call this module once per distinct
# image, `modules/cloudinit-vm` once per VM instance.
#
# Confirmed directly from examples/alpine_cloudinit.tf (fetched and read this
# session, tag v0.9.8) -- the `alpine_base` resource in that file is exactly
# this shape.

resource "libvirt_volume" "base" {
  name = var.image_name
  pool = var.pool_name

  target = {
    format = {
      type = "qcow2"
    }
  }

  create = {
    content = {
      url = var.source_url
    }
  }
}
