TFVars wrote vmid_base and hostpci, which only the Proxmox environment understands. A second backend would have had to declare and ignore them. The variables the runner writes are now listed in provision.Contract and say what the cluster is, not how Proxmox builds it: devices replaces hostpci, and the Proxmox environment derives vmid_base from cluster_id itself (still overridable, which `hpcod provision -vmid-base` now does). A test holds every terraform/envs/*/variables.tf to the contract and TFVars to nothing outside it. Checked by planning the Proxmox environment offline for the same cluster before and after: the planned resources and outputs are byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
164 lines
4.5 KiB
Terraform
164 lines
4.5 KiB
Terraform
variable "pve_endpoint" { type = string }
|
|
variable "pve_token" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
variable "pve_insecure" {
|
|
type = bool
|
|
default = true
|
|
}
|
|
variable "pve_ssh_user" {
|
|
type = string
|
|
default = "root"
|
|
}
|
|
|
|
variable "pve_ssh_host" {
|
|
type = string
|
|
default = "127.0.0.1"
|
|
}
|
|
|
|
variable "pve_ssh_port" {
|
|
type = number
|
|
default = 22
|
|
}
|
|
|
|
variable "pve_ssh_private_key" {
|
|
type = string
|
|
default = "/var/lib/hpcod/.ssh/id_ed25519"
|
|
}
|
|
|
|
# Set when Proxmox's SSH is reachable only through a tunnel.
|
|
variable "pve_ssh_override" {
|
|
type = object({
|
|
address = string
|
|
port = number
|
|
})
|
|
default = null
|
|
}
|
|
|
|
# The cluster is the unit that gets a bridge, a subnet and a name. The
|
|
# tenant is who owns it, and may own several at once.
|
|
variable "cluster_id" { type = number }
|
|
variable "tenant_id" { type = number }
|
|
variable "tenant_name" { type = string }
|
|
variable "node_name" { type = string }
|
|
variable "image_file_id" {
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "head_template_vmid" {
|
|
description = "Prebuilt head node template to clone. Null builds from the cloud image instead, which costs the tenant about twelve minutes of dnf."
|
|
type = number
|
|
default = null
|
|
}
|
|
variable "datastore_id" {
|
|
type = string
|
|
default = "zfspool"
|
|
}
|
|
variable "mgmt_bridge" {
|
|
type = string
|
|
default = "vmbr0"
|
|
}
|
|
variable "mgmt_ip_cidr" { type = string }
|
|
variable "mgmt_gateway" { type = string }
|
|
# Not part of the cluster contract (internal/provision.Contract): VMIDs are
|
|
# this backend's naming, so the environment derives them from cluster_id.
|
|
# Set only to override, e.g. by `hpcod provision -vmid-base`.
|
|
variable "vmid_base" {
|
|
type = number
|
|
default = null
|
|
}
|
|
# No default; site.auto.tfvars carries it, written by `hpcod setup` from CI_USER.
|
|
variable "ci_user" { type = string }
|
|
variable "ssh_public_keys" { type = list(string) }
|
|
|
|
variable "head" {
|
|
type = object({
|
|
cores = number
|
|
memory_gb = number
|
|
disk_gb = number
|
|
})
|
|
}
|
|
variable "compute" {
|
|
type = object({
|
|
count = number
|
|
cores = number
|
|
memory_gb = number
|
|
})
|
|
}
|
|
|
|
variable "snippet_datastore_id" {
|
|
type = string
|
|
default = null
|
|
description = "Datastore holding the cloud-init vendor data snippet. Must have the snippets content type enabled; null disables self-configuration."
|
|
}
|
|
|
|
variable "sdn_zone" {
|
|
type = string
|
|
description = "Existing Proxmox SDN zone for cluster vnets."
|
|
}
|
|
|
|
variable "sdn_zone_type" {
|
|
type = string
|
|
default = "simple"
|
|
description = "The zone's type: simple on one node, vxlan across several. Written by setup from the site."
|
|
}
|
|
|
|
variable "apps" {
|
|
type = list(object({
|
|
name = string
|
|
image = string
|
|
# optional(), so a cluster.auto.tfvars written before these existed
|
|
# still applies. A rebuild that failed at plan with "attribute
|
|
# sif_sha256 is required" would be this change breaking the clusters
|
|
# it was meant to protect.
|
|
digest = optional(string, "")
|
|
sif_sha256 = optional(string, "")
|
|
# What the head needs to make it runnable rather than merely present.
|
|
version = optional(string, "")
|
|
module = optional(string, "")
|
|
binaries = optional(list(string), [])
|
|
}))
|
|
default = []
|
|
}
|
|
|
|
variable "head_host" {
|
|
description = "Hypervisor for the head node, from the placement. Empty means node_name."
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "compute_hosts" {
|
|
description = "Hypervisor for each compute node, in order, from the placement. Empty means all on node_name."
|
|
type = list(string)
|
|
default = []
|
|
}
|
|
|
|
variable "devices" {
|
|
description = "Devices per compute node, keyed by 1-based index, from the placement. On Proxmox a device's native id is its host PCI address, passed through as hostpci."
|
|
type = map(list(string))
|
|
default = {}
|
|
}
|
|
|
|
variable "control_plane_cert" {
|
|
description = "PEM certificate the cluster's portal accepts as its only client."
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "started" {
|
|
description = <<-EOT
|
|
Whether to power the compute nodes on.
|
|
|
|
They PXE boot from the head, so they must stay off until Warewulf on
|
|
it is configured - which is why the build applies twice: once to
|
|
create everything with this false, and again with it true once the
|
|
head's portal answers. Leaving it at false produced a cluster that
|
|
reported ready, published, served a desktop request, and queued it
|
|
for ever behind four nodes that were switched off.
|
|
EOT
|
|
type = bool
|
|
default = false
|
|
}
|