Files
terraform/proxmox/vm.tf
T
2026-09-27 22:17:30 +13:00

66 lines
1014 B
Terraform

resource "proxmox_virtual_environment_vm" "vm" {
name = var.vm_name
node_name = "proxmox"
vm_id = var.vm_id
clone {
vm_id = 9000 # debian-12-cloud template
full = true
}
agent {
enabled = true
}
cpu {
cores = var.vm_cores
type = "x86-64-v2-AES"
}
memory {
dedicated = var.vm_memory
}
disk {
datastore_id = "local-lvm"
interface = "scsi0"
size = var.vm_disk_size
discard = "on"
iothread = true
}
network_device {
bridge = "vmbr0"
model = "virtio"
}
operating_system {
type = "l26"
}
initialization {
datastore_id = "local-lvm"
ip_config {
ipv4 {
address = "dhcp"
}
}
user_account {
username = "debian"
keys = [var.ssh_public_key]
}
}
lifecycle {
ignore_changes = [
initialization[0].user_account[0].password,
]
}
}
output "vm_ipv4_address" {
value = proxmox_virtual_environment_vm.vm.ipv4_addresses
}