Files
spinifex/scripts/iac/proxmox/vms.tf
T
Ben Duncan 5d93786995 refactor: rename hive to spinifex in all shell scripts
- Update scripts/: start-dev, stop-dev, dev-setup, setup, setup-ovn, etc.
- Update tests/e2e/: all E2E test scripts
- Update scripts/iac/: rename hive-test.sh → spinifex-test.sh, update TF files
- Update config/: rename hive.service and install script
- Binary refs use spx, env vars use SPINIFEX_, paths use spinifex
2026-03-18 01:04:12 +00:00

75 lines
1.7 KiB
Terraform

resource "proxmox_virtual_environment_vm" "hive_node" {
count = var.node_count
name = "${var.cluster_name}-${count.index + 1}"
description = "Managed by Terraform"
tags = ["terraform", "spinifex", var.cluster_name]
node_name = var.nodes[count.index % length(var.nodes)].name
initialization {
datastore_id = "local"
vendor_data_file_id = proxmox_virtual_environment_file.cloud_config[count.index].id
user_account {
username = "tf-user"
keys = [trimspace(data.local_file.ssh_public_key.content)]
}
# Management
ip_config {
ipv4 {
address = "dhcp"
}
}
# Data/VM
ip_config {
ipv4 {
address = "dhcp"
}
}
}
cpu {
cores = var.cpu_cores
type = "host"
}
memory {
dedicated = var.memory_mb
}
agent {
enabled = true
}
network_device {
bridge = var.nodes[count.index % length(var.nodes)].bridge
}
network_device {
bridge = var.nodes[count.index % length(var.nodes)].bridge
}
# Clone from template if the target node has template_vmid set, otherwise boot from cloud image.
dynamic "clone" {
for_each = var.nodes[count.index % length(var.nodes)].template_vmid != null ? [1] : []
content {
vm_id = var.nodes[count.index % length(var.nodes)].template_vmid
full = true
}
}
dynamic "disk" {
for_each = var.nodes[count.index % length(var.nodes)].template_vmid == null ? [1] : []
content {
file_id = var.os_image
datastore_id = var.nodes[count.index % length(var.nodes)].datastore_id
interface = "virtio0"
iothread = true
discard = "on"
size = var.disk_size_gb
}
}
}