A Terraform module for creating and managing Proxmox VMs using the Proxmox provider.
- Create single or multiple VMs
- Support for cloning from existing templates
- Cloud-init configuration
- Flexible CPU and memory allocation
- Network configuration
- Storage management
- Predefined instance sizes (xsmall, small, medium, large, xlarge)
module "example_vm" {
source = "./modules/pvevm"
name = "example-vm"
target_node = "pve-node-1"
clone = "ubuntu-template"
storage = "local-lvm"
instance_size = "medium"
# Network configuration
bridge = "vmbr0"
model = "virtio"
# Cloud-init configuration
ciuser = "ubuntu"
cipassword = "your-password"
sshkeys = file("~/.ssh/id_rsa.pub")
}
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | The name of the VM within Proxmox | string |
n/a | yes |
target_node | The name of the Proxmox Node on which to place the VM | string |
null |
no |
clone | The base VM from which to clone to create the new VM | string |
n/a | yes |
storage | Disk Storage Location | string |
n/a | yes |
instance_size | The size of the instance (xsmall, small, medium, large, xlarge) | string |
"" |
no |
cpu | CPU configuration block | object |
null |
no |
memory | The amount of memory to allocate to the VM in Megabytes | number |
null |
no |
size | Disk Size | string |
null |
no |
Name | Description |
---|---|
vm_ip | List of VM IP addresses |
vm_name | List of VM names |
vm_id | List of VM IDs |
vm_vcpus | List of VM vCPU counts |
vm_memory | List of VM memory allocations |
vm_notes | List of VM descriptions/notes |
vm_tags | List of VM tags |
The module provides predefined instance sizes for quick deployment:
Size | Memory | Cores | Sockets | vCores | Disk |
---|---|---|---|---|---|
xsmall | 2GB | 1 | 1 | 1 | 10GB |
small | 4GB | 2 | 1 | 2 | 12GB |
medium | 8GB | 4 | 1 | 4 | 20GB |
large | 16GB | 8 | 1 | 8 | 40GB |
xlarge | 32GB | 10 | 1 | 10 | 60GB |
This module has been updated to use Proxmox provider v3.0.2-rc03 with the following changes:
- Provider Version: Updated from
3.0.1-rc8
to3.0.2-rc03
- Description Field:
desc
parameter changed todescription
- CPU Configuration: Individual
cores
,sockets
, andvcpus
parameters replaced with acpu
block containing:cores
: Number of CPU cores per socketsockets
: Number of CPU socketsvcores
: Total number of virtual CPUs
The module maintains backward compatibility by still supporting the old individual parameters.
This module is licensed under the MIT License.
Name | Version |
---|---|
terraform | >= 0.13.0 |
proxmox | 3.0.2-rc03 |
Name | Version |
---|---|
proxmox | 3.0.2-rc03 |
No modules.
Name | Type |
---|---|
proxmox_vm_qemu.pvevm | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
agent | Qemu Guest Agent Enabled or not enabled=1 | number |
1 |
no |
bridge | Map of tags to add to the VM. Stored as JSON in the Notes field in Proxmox. | string |
"vmbr0" |
no |
cipassword | Override the default cloud-init user's password | string |
n/a | yes |
ciuser | Override the default cloud-init user for provisioning | string |
n/a | yes |
clone | The base VM from which to clone to create the new VM | string |
n/a | yes |
connection | Provisioner connection settings | map(string) |
{ |
no |
cores | The number of CPU cores per CPU socket to allocate to the VM | number |
null |
no |
cpu | CPU configuration block | object({ |
null |
no |
disks | VM disk config | list(map(string)) |
[ |
no |
gateway | Gateway IP Address | string |
"" |
no |
id | New required field proxmox | number |
0 |
no |
instance_count | Instance Count | number |
1 |
no |
instance_size | The size of the instance (small, medium, large). If empty, custom values must be provided. | string |
"" |
no |
instance_sizes | Map of instance sizes with predefined settings | map(object({ |
{ |
no |
ip_addresses | List of IP addresses with cidr notation | list(string) |
[] |
no |
ipconfig0 | The first IP address to assign to the guest. Format: [gw=] [,gw6=] [,ip=<IPv4Format/CIDR>] [,ip6=<IPv6Format/CIDR>] | string |
"ip=dhcp" |
no |
ipconfig1 | The second IP address to assign to the guest. Same format as ipconfig0 | string |
null |
no |
ipconfig2 | The third IP address to assign to the guest. Same format as ipconfig0 | string |
null |
no |
memory | The amount of memory to allocate to the VM in Megabytes | number |
null |
no |
model | Network Model | string |
"virtio" |
no |
name | The name of the VM within Proxmox | string |
n/a | yes |
nameserver | Sets default DNS server for guest | string |
null |
no |
networks | VM network adapter config | list(map(string)) |
[ |
no |
notes | VM notes field that maps to desc | string |
"Managed by Terraform." |
no |
ostype | The OS Type | string |
"cloud-init" |
no |
pool | The destination resource pool for the new VM | string |
null |
no |
proxmox_api_token_id | API Token | string |
n/a | yes |
proxmox_api_token_secret | API Secret | string |
n/a | yes |
proxmox_api_url | Full Proxmox API URL | string |
n/a | yes |
proxmox_tls_insecure | Allow Insecure TLS | bool |
true |
no |
scsihw | scsi hardware type | string |
"virtio-scsi-pci" |
no |
searchdomain | Sets default DNS search domain suffix | string |
null |
no |
serial0 | serial device in order for console device to work | number |
0 |
no |
size | Disk Size | string |
null |
no |
sockets | The number of CPU sockets to allocate to the VM | number |
null |
no |
sshkeys | Newline delimited list of SSH public keys to add to authorized keys file for the cloud-init user | string |
n/a | yes |
storage | Disk Storage Location | string |
n/a | yes |
tag | Vlan ID | number |
null |
no |
tags | tags comma seperated | string |
"" |
no |
target_node | The name of the Proxmox Node on which to place the VM | string |
null |
no |
target_nodes | The name of the Proxmox Node on which to place the VM | list(string) |
null |
no |
vcpus | The number of vCPU to allocate to the VM | number |
null |
no |
vmid | The vm id of the VM within Proxmox. Default is next available | number |
0 |
no |
Name | Description |
---|---|
vm_id | VM IDS |
vm_ip | VM IP Addresses |
vm_memory | VM Memory |
vm_name | VM NAMES |
vm_nameserver | VM Nameservers |
vm_notes | VM Notes |
vm_tags | VM Tags |
vm_vcpus | VM VCPUS |