diff --git a/terraform/main.tf b/terraform/main.tf index 68c799d..cb269b5 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,6 +1,25 @@ -resource "proxmox_vm_qemu" "ubuntu2404" { +terraform { + required_providers { + proxmox = { + source = "telmate/proxmox" + version = "3.0.2-rc07" + } + } +} + +provider "proxmox" { + pm_api_url = "https://proxmox.example.com:8006/api2/json" + pm_user = "root@pam" + pm_password = "yourpassword" + pm_tls_insecure = true +} + +resource "proxmox_vm_qemu" "ubuntu2404_vm" { name = "terraform-vm" target_node = "nuctyzyzen7-1" + vmid = 9505 + full_clone = true + clone = "ubuntu-2404-ci-template" # jouw werkende template cores = 2 sockets = 1 @@ -9,20 +28,18 @@ resource "proxmox_vm_qemu" "ubuntu2404" { machine = "q35" agent = 1 - # Bootdisk vanaf cloud image + # Bootdisk clonen van template disk { - slot = "scsi0" + slot = "virtio0" type = "disk" storage = "zfs1" - size = "20G" - format = "qcow2" + size = "32G" cache = "writeback" discard = true - # Als je image al geüpload is, kun je clone= gebruiken - # clone = "999/virtio0" + clone = "ubuntu-2404-ci-template/virtio0" # belangrijk! } - # Cloud-init drive + # Cloud-init CD-ROM wordt automatisch toegevoegd disk { slot = "scsi1" type = "cdrom" @@ -35,7 +52,7 @@ resource "proxmox_vm_qemu" "ubuntu2404" { bridge = "vmbr0" } - # Cloud-init configuratie + # Cloud-init instellingen os_type = "cloud-init" ciuser = "martijn" cipassword = "Gwh28dgcmp!"