Homelab/terraform/pve1/main.tf
Tellsanguis 4c277c7594
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Failing after 6s
CD - Deploy Infrastructure / Deploy on pve1 (push) Has been skipped
CD - Deploy Infrastructure / Deploy on pve2 (push) Has been skipped
CD - Deploy Infrastructure / Deploy on pve3 (push) Has been skipped
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
fix(terraform): Utiliser disks block pour cloner correctement le template Ubuntu
- Remplacer disk{} par disks{scsi{}} pour activer le clonage
- Le disk{} créait un disque vide au lieu de cloner le template
- Résout le problème 'No bootable device' en clonant correctement les partitions
2025-11-27 18:52:32 +01:00

80 lines
1.7 KiB
HCL

terraform {
required_version = ">= 1.6.0"
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "3.0.2-rc05"
}
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 acemagician
resource "proxmox_vm_qemu" "k3s_server_1" {
vmid = 1000
name = "k3s-server-1"
target_node = "acemagician"
clone = var.ubuntu_template
full_clone = true
force_create = true
# Configuration CPU
cpu {
cores = var.k3s_server_1_config.cores
sockets = 1
type = "host"
}
memory = var.k3s_server_1_config.memory
agent = 1
# Configuration vidéo - Standard VGA
vga {
type = "std"
}
boot = "order=scsi0"
scsihw = "virtio-scsi-single"
onboot = true
network {
id = 0
model = "virtio"
bridge = var.k3s_network_bridge
}
# Le disque est cloné automatiquement depuis le template
# Pas de disk block pour éviter de créer un disque vide
disks {
scsi {
scsi0 {
disk {
size = var.k3s_server_1_config.disk_size
storage = var.k3s_server_1_storage_pool
iothread = true
}
}
}
}
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]
}