variable "vm_name" {
  description = "Domain name, e.g. \"office1-netbox\", \"office1-maas-region\"."
  type        = string
}

variable "memory_mib" {
  description = "Memory in MiB. No default -- pass explicitly."
  type        = number
}

variable "vcpu" {
  description = "Virtual CPU count. No default -- pass explicitly."
  type        = number
}

variable "pool_name" {
  description = "libvirt_pool this VM's disk + cloud-init seed volume live in."
  type        = string
}

variable "disk_size_bytes" {
  description = "Boot disk size in bytes (the backing_store overlay's capacity, not the base image's). No default -- pass explicitly."
  type        = number
}

variable "base_volume_path" {
  description = <<-EOT
    Host filesystem path of the base image this VM boots from -- pass
    modules/base-image's `path` OUTPUT directly (a real resource attribute),
    e.g. `module.ubuntu_base.path`. Do not reconstruct this from a pool name
    + volume name; libvirt's actual pool-relative path convention was not
    independently confirmed this session (see main.tf's note on this).
  EOT
  type        = string
}

variable "network_names" {
  description = "Ordered list of libvirt_network names (outputs of modules/dc-planes or modules/mesh-link) this VM attaches to."
  type        = list(string)
}

variable "user_data" {
  description = <<-EOT
    Full #cloud-config YAML content (a real, chosen configuration -- hostname,
    packages, users, etc. for THIS specific VM). No default and no generic
    fallback content is provided here: what Office1's MAAS-region/NetBox/
    GitBucket VMs actually need installed/configured is real design work that
    hasn't been done yet, and inventing placeholder cloud-config content would
    misrepresent it as a real decision. Pass the actual config once written.
  EOT
  type        = string
}

variable "meta_data" {
  description = "Cloud-init meta-data YAML (instance-id, local-hostname). No default -- pass explicitly, instance-id must be unique per VM."
  type        = string
}

variable "network_config" {
  description = <<-EOT
    Cloud-init network-config YAML (version 2 netplan-style). No default and
    deliberately NOT a "dhcp4: true" fallback: this repo's plane networks
    carry no libvirt-managed DHCP (NetBox is the IPAM apex, skill hard rule
    3), so a real static address from NetBox is required here, not a
    plausible-looking default that would silently fail to reach anything.
  EOT
  type        = string
}

variable "expose_nested_virt" {
  description = <<-EOT
    Whether this guest may itself run KVM guests (nested virtualisation).

    TRUE  -- pass the host's `svm` feature through. REQUIRED for any VM that is
             registered to MAAS as an LXD VM host and has VMs composed into it
             (D-114: the site containment VMs voffice1/vvr1-dc0/vvr1-dc1). Without it the
             guest gets no svm flag, LXD virtual machines cannot start, and the
             D-114 model fails at its first step.
    FALSE -- disable `svm`, matching modules/opnsense-edge. Correct hardening for
             a guest that has no business seeing nested virt.

    No default: this is a real decision per VM, not a fallback. NOTE the domain
    always uses cpu mode "host-passthrough" -- with NO cpu block at all (this
    module's state before 2026-07-13) libvirt renders a generic emulated CPU model
    that exposes no svm regardless of what this flag says.
  EOT
  type        = bool
}

variable "autostart" {
  description = "Start this domain automatically when the libvirt host boots (D-127 boot matrix). MANUAL (false) for DC containment + node VMs; true for foundational service VMs + edges. Set explicitly per instance in the root -- do not rely on the default."
  type        = bool
  default     = false
}
