Files
spinifex/scripts/iac/proxmox/.env.example
T

69 lines
2.4 KiB
Bash

# Proxmox IaC Environment Configuration
# Copy this file to .env and fill in your values:
# cp .env.example .env
#
# Then source it before running tofu:
# source .env && tofu plan
# --- Proxmox API ---
# API token for Proxmox VE (read by the provider directly)
export PROXMOX_VE_API_TOKEN="terraform@pve!provider=YOUR_TOKEN_HERE"
# Proxmox VE API endpoint URL
export TF_VAR_proxmox_endpoint="https://pve-host.example.com:8006/"
# --- SSH Access ---
# SSH username on Proxmox hosts (used by provider for file uploads)
export TF_VAR_proxmox_ssh_username="terraform"
# Path to SSH private key for Proxmox host access
export TF_VAR_ssh_private_key_path="~/.ssh/proxmox-host-tf"
# Path to SSH public key injected into VMs via cloud-init (for tf-user)
export TF_VAR_ssh_public_key_path="~/.ssh/cloud-init.pub"
# --- Proxmox Nodes ---
# Physical Proxmox hosts where VMs are placed (round-robin).
# You can define 1 or more nodes — VMs are distributed across them.
#
# Each node object:
# name - Proxmox node name (as shown in the Proxmox UI)
# address - SSH-reachable hostname or IP of the Proxmox host
# bridge - Network bridge for VM interfaces (e.g. vmbr0, vmbr3)
# datastore_id - Proxmox storage ID for VM disks (e.g. local, local-lvm)
# template_vmid - (optional) VMID of a pre-built template on this node.
# Build with scripts/iac/proxmox-template/, then distribute
# with vzdump. When set, VMs clone from the template (fast).
# When omitted, VMs boot from os_image (slower).
export TF_VAR_nodes='[
{
"name": "node1",
"address": "node1.example.com",
"bridge": "vmbr0",
"datastore_id": "local"
},
{
"name": "node2",
"address": "node2.example.com",
"bridge": "vmbr0",
"datastore_id": "local"
},
{
"name": "node3",
"address": "node3.example.com",
"bridge": "vmbr0",
"datastore_id": "local"
}
]'
# Example with templates (VMIDs may differ per node after vzdump restore):
#
# export TF_VAR_nodes='[
# { "name": "node1", "address": "node1.example.com", "bridge": "vmbr0", "datastore_id": "local", "template_vmid": 9999 },
# { "name": "node2", "address": "node2.example.com", "bridge": "vmbr0", "datastore_id": "local-lvm", "template_vmid": 9997 },
# { "name": "node3", "address": "node3.example.com", "bridge": "vmbr0", "datastore_id": "ssd", "template_vmid": 9998 }
# ]'