Homelab/terraform/pve1/main.tf

67 lines
1.4 KiB
Terraform
Raw Normal View History

2025-11-07 09:33:38 +01:00
terraform {
required_version = ">= 1.6.0"
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "3.0.2-rc05"
2025-11-07 09:33:38 +01:00
}
local = {
source = "hashicorp/local"
2025-11-07 09:33:38 +01:00
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
2025-11-07 09:33:38 +01:00
resource "proxmox_vm_qemu" "k3s_server_1" {
vmid = 1000
2025-11-07 09:33:38 +01:00
name = "k3s-server-1"
target_node = "acemagician"
2025-11-07 09:33:38 +01:00
clone = var.ubuntu_template
full_clone = true
2025-11-07 09:33:38 +01:00
cpu {
cores = var.k3s_server_1_config.cores
sockets = 1
}
memory = var.k3s_server_1_config.memory
agent = 1
2025-11-07 09:33:38 +01:00
boot = "order=scsi0"
scsihw = "virtio-scsi-single"
onboot = true
2025-11-07 09:33:38 +01:00
network {
id = 0
2025-11-07 09:33:38 +01:00
model = "virtio"
bridge = var.k3s_network_bridge
}
disk {
slot = "scsi0"
size = var.k3s_server_1_config.disk_size
type = "disk"
storage = var.k3s_server_1_storage_pool
iothread = true
2025-11-07 09:33:38 +01:00
}
ipconfig0 = "ip=${var.k3s_server_1_config.ip},gw=${var.k3s_gateway}"
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-1.yaml"
2025-11-07 09:33:38 +01:00
nameserver = join(" ", var.k3s_dns)
lifecycle {
ignore_changes = [network]
2025-11-07 09:33:38 +01:00
}
depends_on = [local_file.k3s_server_cloud_init]
}