admin管理员组

文章数量:1122826

I can't get it to work properly using terraform vm. Whenever I run the terraform, either the vmname is not applied and all cloudint settings are discarded.

Or if I customize something, I get the following error message “end kernel panic not syncing” in the newly created vm.

I suspect my basis is simply wrong.

I would also like to know what needs to match between template and terraform resource. Or how does the whole thing work with terraform.

I have created my template from the following link step by step. /

My terraform script looks like this:

resource "proxmox_vm_qemu" "test-case-15" {
    name = "humus-3"
    desc = "test blae"
    target_node = "eva"

    vmid = 991
    agent = 1

    clone = "test-temp-no-start"
    full_clone = true

    vga {
        type = "virtio"
    }

  os_type = "l26"
  cores = 2
  sockets = 1

  scsihw   = "virtio-scsi-single"

  disks {
    scsi {
      scsi0 {
        disk {
          size = 20
          storage = "local-lvm"
        }
      }
    }
  }

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

 ipconfig0 = "ip=dhcp"
 }

Here are the Terraform provider details:

terraform {
 required_providers {
   proxmox = {
     source = "telmate/proxmox"
     version = "3.0.1-rc4"
   }
  }

 required_version = ">= 1.7.1"
}

variable "proxmox_api_url" {
   type = string
}

variable "proxmox_api_token_id" {
   type = string
   sensitive = true
}

variable "proxmox_api_token_secret" {
   type =  string
   sensitive = true
}

provider "proxmox" {
   pm_api_url= var.proxmox_api_url
   pm_api_token_id = var.proxmox_api_token_id
   pm_api_token_secret = var.proxmox_api_token_secret
   pm_tls_insecure = true
   pm_debug = true
   pm_log_levels = {
     _default    = "debug"
     _capturelog = ""
   }
}

my template conf:

agent: 1
boot: order=ide2;scsi0;net0
cipassword: $5$XXUY1nUM$Fu5Oll4nxoO9LpQRBWbvQPrVRdBfWF4PvWh77cpoN37
ciuser: bote
cores: 2
ide0: local-lvm:vm-109-cloudinit,media=cdrom,size=4M
ide2: none,media=cdrom
ipconfig0: ip=dhcp
memory: 2048
meta: creation-qemu=9.0.2,ctime=1732140151
name: test-temp-no-start
net0: virtio=BC:24:11:50:E1:2A,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
scsi0: local-lvm:base-109-disk-0,discard=on,iothread=1,size=20G,ssd=1
scsihw: virtio-scsi-single
serial0: socket
smbios1: uuid=711d1814-4c72-4b08-80ac-7617c0a2de24
sockets: 1
template: 1
vga: serial0
vmgenid: ad659086-8c71-4e25-80de-2315c48fb00d

Proxmox version -> Virtual Environment 8.2.9

本文标签: proxmoxhow to clone a vm template correctly with terraformStack Overflow