terraform { required_providers { proxmox = { source = "bpg/proxmox" version = "0.114.0" } } } # ------------------------------------------------------------------ # Optional second disk – create it only when the flag is true. # ------------------------------------------------------------------ resource "proxmox_virtual_environment_container" "example_template" { description = "Managed by Terraform" start_on_boot = var.start_on_boot unprivileged = var.unprivileged features { nesting = var.nesting_enabled } wait_for_ip { ipv4 = true } # ---- Disk(s) ---------------------------------------------------- disk { datastore_id = var.datastore_id # <- primary disk size = var.disk_size_gb # in GB } mount_point { volume = var.datastore_id_media # <- secondary disk size = var.disk_size_gb_media # in GB path = "/media" } mount_point { volume = var.datastore_id_download_tmp # <- tertiary disk size = var.disk_size_gb_download_tmp # in GB path = "/download_tmp" } # ------------------------------------------------------------------ # Mount points – uncomment and set if you need to mount a volume. # ------------------------------------------------------------------ #mount_point { # volume = var.mount_volume # size = "4G" # path = "/mnt/local" #} # ---- Initialization ------------------------------------------------- initialization { dns { servers = ["1.1.1.1", "8.8.8.8"] } hostname = var.hostname ip_config { ipv4 { address = var.ip_address gateway = var.gateway } } user_account { password = var.password # keys = [trimspace(tls_private_key.example.public_key_openssh)] } } # ---- Network ---------------------------------------------------- network_interface { name = "veth0" mtu = 1450 } device_passthrough { deny_write = "false" gid = 0 mode = "0660" path = "/dev/net/tun" uid = 0 } node_name = var.node_name vm_id = var.vm_id operating_system { template_file_id = var.template_file_id type = "debian" } tags = [ "deb13", "terraform", ] cpu { cores = var.cores } memory { dedicated = var.memory swap = var.swap } startup { order = "3" up_delay = "60" down_delay = "60" } }