Terraform Proxmox Module
  • HCL 90.4%
  • JavaScript 9.6%
Find a file
Infrapunks Bot f10c694fc3
All checks were successful
pre-commit-check / pre-commit (push) Successful in 39s
Release / release (push) Successful in 10s
chore: sync repo configuration
2026-02-01 17:13:18 +01:00
.forgejo/workflows chore(docker): update git.bueraner.de/murdoc/docker-semantic-release:latest docker digest to 6849fe0 2026-01-27 00:13:03 +00:00
.editorconfig feat: add proxmox tf module for cloud init VMs 2025-07-29 07:14:57 +02:00
.gitignore feat: add proxmox tf module for cloud init VMs 2025-07-29 07:14:57 +02:00
.markdownlint.json chore: disable markdown lint check MD060 2026-01-06 21:39:27 +01:00
.pre-commit-config.yaml chore: sync repo configuration 2026-02-01 17:13:18 +01:00
CHANGELOG.md chore(release): 1.4.0 [skip ci] 2025-10-23 06:27:57 +02:00
main.tf chore: remove remote-exec provisioner 2025-07-29 21:09:35 +02:00
outputs.tf chore: remove unused output vars 2025-07-30 06:23:34 +02:00
providers.tf chore(deps): update terraform proxmox to v3.0.2-rc07 2025-12-19 05:23:16 +00:00
README.md docs: update tf provider 2025-12-20 14:59:34 +01:00
release.config.mjs feat: add proxmox tf module for cloud init VMs 2025-07-29 07:14:57 +02:00
renovate.json chore: remove postUpgradeTasks 2025-10-24 05:58:57 +02:00
variables.tf feat: change default dns server 2025-08-24 10:20:26 +02:00

Terraform Proxmox Virtual Machine Module

Requirements

Name Version
terraform >= 1.10.2
external >= 2.0.0
local ~> 2.1
null ~> 3.2
proxmox 3.0.2-rc07
random ~> 3.6
time ~> 0.13

Providers

Name Version
proxmox 3.0.2-rc07

Modules

No modules.

Resources

Name Type
proxmox_vm_qemu.proxmox-vm resource

Inputs

Name Description Type Default Required
default_tags Default tags added to each VM. list(string)
[
"terraform",
"proxmox"
]
no
proxmox_vm Map containing VM configurations.
Key = unique VM name.
Each VM object must contain the following attributes:
- vm_id: Unique VM ID in the Proxmox cluster (integer)
- hostname: Hostname of the VM (string)
- ciuser: Cloud-Init username (string)
- cipassword: Cloud-Init password (string, must not be empty)
- memory: Amount of RAM in MB (integer)
- boot_disk_size: Size of the boot disk (e.g. "10G") (string)
- cidr: IP address and subnet in CIDR notation (e.g. "192.168.1.10/24") (string)
- NAT_gateway_IPv4: Default IPv4 gateway (string)
- vnic_bridge: Proxmox network bridge (e.g. "vmbr0") (string)
- tags: (optional) List of tags (list(string))
All other attributes are documented below.
map(object({
# --- Basic info ---
vm_id = number # Unique VM ID in the Proxmox cluster
hostname = string # Hostname of the VM
description = optional(string, "Do not touch this VM, it is managed by Terraform!") # Optional description (default: "Do not touch this VM, it is managed by Terraform!")
target_node = string # Target Proxmox node name


# --- Cloud-Init config ---
ciuser = string # Cloud-Init username
cipassword = string
img_template = optional(string, "packer-ubuntu2404") # Cloud init template (default: packer-ubuntu2404)I
full_clone = optional(bool, "true") # The base VM name from which to clone to create the new VM (default: true)
cloud_init_storage = optional(string, "local") # Cloud init storag (default: local)

# --- CPU config ---
cpu_cores = number # Number of CPU cores
cpu_affinity = optional(string, "") # Optional CPU affinity mask (default: "" <- no affinity)
cpu_limit = optional(number, 0) # CPU usage limit (0 = no limit)
cpu_type = optional(string, "host") # CPU type (e.g. "host", "qemu64")
cpu_numa = optional(bool, false) # NUMA support enabled (default: true)
cpu_sockets = optional(number, 1) # Number of CPU sockets
cpu_units = optional(number, 0) # CPU units (0 = default)
cpu_vcores = optional(number, 0) # Number of virtual CPU cores (default: 0)

# --- Memory config ---
memory = number # Amount of RAM in MB
balloon = optional(number, 2048) # Minimum memory with ballooning (default: 2048 MB)

# --- Disk config ---
boot_disk_size = string # Size of the boot disk (e.g. "20G")
boot_disk_storage = optional(string, "local") # Storage backend for the boot disk
boot_disk_iothread = optional(bool, false) # Enable I/O thread for the boot disk (default: false)
boot_disk_ssd = optional(bool) # Mark boot disk as SSD
boot_disk_discard = optional(bool, false) # Enable discard/TRIM for the boot disk (default: false)
boot_disk_cache = optional(string, "writeback") # The drives cache mode. Options: directsync, none, unsafe, writeback, writethrough. (default: writeback)


# --- Network config ---
cidr = string # IP address with subnet in CIDR notation
NAT_gateway_IPv4 = optional(string, "192.168.1.1") # Default IPv4 gateway
vnic_bridge = optional(string, "vmbr0") # Proxmox network bridge (e.g. vmbr0)
skip_ipv6 = optional(bool, true) # Tells proxmox that acquiring an IPv6 address from the qemu guest agent isn't required, it will still return an ipv6 address if it could obtain one. Useful for reducing retries in environments without ipv6. (default: true)

# --- Misc ---
tags = optional(list(string), []) # Tags for the VM (default: empty list)
onboot = optional(bool, true) # "Whether the VM should automatically start when the Proxmox node boots (default: true)
vm_state = optional(string, "started")
boot_at_pve_start = optional(bool, true) # Start VM on Proxmox start (default: true)
agent = optional(number, 1) # Set to 1 to enable the QEMU Guest Agent. Note, you must run the qemu-guest-agent daemon in the guest for this to have any effect. (default: 1)

# --- Cloud-Init DNS ---
dns_searchdomain = optional(string, "fritz.box") # DNS search domain (default: fritz.box)
dns_nameserver = optional(string, "192.168.1.230") # DNS nameserver (default: 192.168.1.230)

# --- Upgrade ---
ciupgrade = optional(bool, true) # Upgrade packages on boot (default: true)
}))
n/a yes

Outputs

Name Description
vm_names Host names of the VMs