Menu

From a bare Proxmox host to Debian VMs in one command, with Terraform and cloud-init
📰

From a bare Proxmox host to Debian VMs in one command, with Terraform and cloud-init

DEV Community: terraform·Nickolas Maia de Araujo·2 days ago
#kvlEXS5j
#devtoterraform#devto#dev#terraform#proxmox
Reading 0:00
15s threshold

Clicking through the Proxmox UI to create a VM is fine the first time. By the fifth VM you have five slightly different machines, and you are not sure which one has your SSH key or the right disk size. This post shows the setup I use instead: a cloud-init template built once, and Terraform that creates every VM from a short list.

Everything here is in a free repository, Rackplinth Lite (MIT). It was tested on Proxmox VE 9.2 with OpenTofu 1.13 and the bpg/proxmox provider 0.122.

The plan

Build a Debian 13 template from the official cloud image, with the QEMU guest agent inside.

Give Terraform an API token.

Describe the VMs in a map and run terraform apply .

Each VM comes up with a static IP and your SSH key, and password login is off. Terraform also writes an Ansible inventory, so you can start configuring the VMs right away.

Step 1: a template you can trust

Debian publishes cloud images with SHA512 checksums.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.