infrastructure/pve01.wheatley.in/k8s-wheatley/modules/controlplane/main.tf

64 lines
1.1 KiB
Terraform
Raw Normal View History

2025-10-24 23:41:05 +02:00
terraform {
required_providers {
proxmox = {
2025-10-26 11:42:08 +01:00
source = "bpg/proxmox"
version = "0.85.1"
2025-10-24 23:41:05 +02:00
}
}
}
2025-10-26 11:42:08 +01:00
resource "proxmox_virtual_environment_vm" "controlplane" {
2025-10-24 23:41:05 +02:00
2025-10-26 11:42:08 +01:00
name = format("k8s-wheatley-%s", var.controlplane.node_name)
node_name = "pve01"
tags = ["k8s-wheatley,controlplane"]
bios = "ovmf"
on_boot = true
machine = "q35"
stop_on_destroy = true
operating_system {
type = "l26"
}
agent {
enabled = true
2025-10-24 23:41:05 +02:00
}
cpu {
2025-10-26 11:42:08 +01:00
cores = var.controlplane.cpu
2025-10-24 23:41:05 +02:00
sockets = 1
2025-10-26 11:42:08 +01:00
type = "host"
}
memory {
dedicated = var.controlplane.memory * 1024
}
disk {
datastore_id = var.controlplane.storagepool
interface = "virtio0"
size = var.controlplane.disk * 1024
file_format = "raw"
2025-10-24 23:41:05 +02:00
}
2025-10-26 11:42:08 +01:00
initialization {
datastore_id = var.controlplane.storagepool
ip_config {
ipv4 {
address = var.controlplane.node_ipv4_address
gateway = var.controlplane.ipv4_gateway
}
}
dns {
servers = ["10.13.37.2"]
}
}
2025-10-24 23:41:05 +02:00
2025-10-26 11:42:08 +01:00
network_device {
2025-10-24 23:41:05 +02:00
bridge = "vmbr1"
2025-10-26 11:42:08 +01:00
mac_address = var.controlplane.mac_address
2025-10-24 23:41:05 +02:00
}
2025-10-26 11:42:08 +01:00
2025-10-24 23:41:05 +02:00
}