Files
PSProxmoxVE/tests/infrastructure/main.tf
T
goodolclint-claude[bot] f48f0ea9ae ci: storage and answer services move to a VM inside the CI sandbox (1/2)
The nested PVE guests live on an isolated VLAN with no route to the
runner network (ADR 0032, homelab repo), and the runner-hosted Docker
services died with each ephemeral ARC pod anyway. A small cloud-image VM
in the ci pool now serves NFS, iSCSI, and the auto-install answer files
from inside the sandbox. Includes fixes from Codex and in-house review:
bpg provider >= 0.79.0, serial console for the resized cloud image,
key-based SSH (cloud images refuse password auth), CIDR validation,
storage VM in the headroom check, docker socket mounts removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 19:52:36 +00:00

95 lines
2.0 KiB
Terraform

terraform {
required_version = ">= 1.5.0"
required_providers {
proxmox = {
source = "bpg/proxmox"
# disk.import_from and content_type "import" need >= 0.79.0
version = ">= 0.79.0"
}
}
}
provider "proxmox" {
endpoint = var.proxmox_endpoint
api_token = var.proxmox_api_token
insecure = var.proxmox_insecure
}
resource "proxmox_virtual_environment_file" "auto_iso" {
for_each = var.pve_isos
content_type = "iso"
datastore_id = var.iso_storage
node_name = var.target_node
overwrite = true
source_file {
path = each.value
}
}
# ── Nested PVE VMs ────────────────────────────────────────────────────
resource "proxmox_virtual_environment_vm" "nested_pve" {
for_each = var.pve_instances
name = each.value.vm_name
node_name = var.target_node
vm_id = each.value.vm_id
pool_id = var.pool_id
machine = "q35"
bios = "ovmf"
boot_order = ["scsi0", "ide2"]
cpu {
type = "host"
cores = var.cores
sockets = 1
}
memory {
dedicated = var.memory
}
efi_disk {
datastore_id = var.disk_storage
type = "4m"
}
disk {
datastore_id = var.disk_storage
interface = "scsi0"
size = var.disk_size
file_format = "raw"
}
cdrom {
file_id = proxmox_virtual_environment_file.auto_iso[each.value.pve_version].id
interface = "ide2"
}
network_device {
bridge = var.network_bridge
model = "virtio"
mac_address = each.value.mac_address
}
operating_system {
type = "l26"
}
agent {
enabled = true
}
started = true
# VMs must not boot until the storage VM exists — it serves the HTTP answer
# files the PVE auto-installer fetches. run-integration.sh additionally
# configures the storage VM (phase one) before applying these resources.
depends_on = [proxmox_virtual_environment_vm.storage]
lifecycle {
ignore_changes = [started, cdrom]
}
}