Changed from nested `disks` block (v3.0 syntax) to flat `disk` block
(v2.9 syntax):
- disks { scsi { scsi0 { disk {...} } } } → disk { slot = 0, ... }
- Added explicit slot, type, and iothread parameters
- Maintains same functionality with v2.9-compatible syntax
60 lines
1.3 KiB
HCL
60 lines
1.3 KiB
HCL
terraform {
|
|
required_version = ">= 1.6.0"
|
|
|
|
required_providers {
|
|
proxmox = {
|
|
source = "telmate/proxmox"
|
|
version = "~> 2.9"
|
|
}
|
|
local = {
|
|
source = "hashicorp/local"
|
|
version = "~> 2.1"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "proxmox" {
|
|
pm_api_url = var.proxmox_api_url
|
|
pm_api_token_id = var.proxmox_token_id
|
|
pm_api_token_secret = var.proxmox_token_secret
|
|
pm_tls_insecure = var.proxmox_tls_insecure
|
|
}
|
|
|
|
# K3s Server VM on pve1
|
|
resource "proxmox_vm_qemu" "k3s_server_1" {
|
|
name = "k3s-server-1"
|
|
target_node = "pve1"
|
|
clone = var.ubuntu_template
|
|
|
|
cores = var.k3s_server_1_config.cores
|
|
sockets = 1
|
|
memory = var.k3s_server_1_config.memory
|
|
agent = 1
|
|
|
|
boot = "order=scsi0"
|
|
scsihw = "virtio-scsi-single"
|
|
onboot = true
|
|
|
|
network {
|
|
model = "virtio"
|
|
bridge = var.k3s_network_bridge
|
|
}
|
|
|
|
disk {
|
|
slot = 0
|
|
size = var.k3s_server_1_config.disk_size
|
|
type = "scsi"
|
|
storage = var.storage_pool
|
|
iothread = 1
|
|
}
|
|
|
|
ipconfig0 = "ip=${var.k3s_server_1_config.ip},gw=${var.k3s_gateway}"
|
|
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-1.yaml"
|
|
nameserver = join(" ", var.k3s_dns)
|
|
|
|
lifecycle {
|
|
ignore_changes = [network]
|
|
}
|
|
|
|
depends_on = [local_file.k3s_server_cloud_init]
|
|
}
|