Project

General

Profile

Actions

Task #50

open

Use Terraform to provision Ubuntu virtual machines

Added by Frank Refol 5 months ago. Updated 5 months ago.

Status:
New
Priority:
Must Have
Assignee:
Category:
-
Start date:
05/30/2025
Due date:
% Done:

0%

Estimated time:

Description

An Ubuntu virtual machine is currently being provisioned using a pure Ansible playbook and using a virtual machine template in Proxmox. Convert this so that it uses Terraform or OpenTofu instead.

https://www.youtube.com/watch?v=Rey7LdSdjJY

HCL File Example

Here is an example of a Terraform configuration file (HCL),

provider "proxmox" {
  pm_api_url      = "https://your-proxmox-server:8006/api2/json"
  pm_user         = "root@pam"
  pm_password     = "your-password"
  pm_tls_insecure = true  # Set to false if using valid TLS
}

resource "proxmox_vm_qemu" "vm" {
  name        = "terraform-vm"
  target_node = "proxmox-node"

  clone      = "template-name"  # Replace with your Proxmox VM template name
  vmid       = 100
  cores      = 2
  memory     = 4096
  sockets    = 1
  disk {
    storage = "local-lvm"
    size    = "50G"
  }

  network {
    model  = "virtio"
    bridge = "vmbr0"
  }

  agent = 1
}

Providers

BPG

https://search.opentofu.org/provider/bpg/proxmox/latest
https://registry.terraform.io/providers/bpg/proxmox/latest/docs#example-usage

Telmate

https://search.opentofu.org/provider/telmate/proxmox/latest

Actions #1

Updated by Frank Refol 5 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF