aboutsummaryrefslogtreecommitdiff
path: root/opentofu/modules/k8s_worker
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2025-02-06 22:13:14 +0100
committerclyhtsuriva <aimeric@adjutor.xyz>2025-02-06 22:13:14 +0100
commit1e0f492b1d7f998cb7996e0f307c1e32a07cea36 (patch)
treea38841b266894d6f0b12776cee3f1b20b4469c83 /opentofu/modules/k8s_worker
parentaeedb9882aa597a45dd43a1664d604c5f1a2d4f8 (diff)
opentofu: completely migrated k8-cluster.tf to modules
Successfully built on proxmox
Diffstat (limited to 'opentofu/modules/k8s_worker')
-rw-r--r--opentofu/modules/k8s_worker/main.tf56
-rw-r--r--opentofu/modules/k8s_worker/outputs.tf3
-rw-r--r--opentofu/modules/k8s_worker/variables.tf26
-rw-r--r--opentofu/modules/k8s_worker/versions.tf10
4 files changed, 95 insertions, 0 deletions
diff --git a/opentofu/modules/k8s_worker/main.tf b/opentofu/modules/k8s_worker/main.tf
new file mode 100644
index 0000000..ff039b2
--- /dev/null
+++ b/opentofu/modules/k8s_worker/main.tf
@@ -0,0 +1,56 @@
+resource "proxmox_vm_qemu" "k8s_worker" {
+ lifecycle {
+ ignore_changes = [
+ bootdisk,
+ ]
+ }
+
+ count = var.vm_count
+ name = "${var.name_prefix}-${count.index}"
+ desc = var.desc
+ agent = var.agent
+ target_node = var.target_node
+ tags = var.tags
+
+ clone = var.clone
+ full_clone = var.full_clone
+
+ qemu_os = var.qemu_os
+ cores = var.cores
+ sockets = var.sockets
+ cpu_type = var.cpu_type
+ memory = var.memory
+
+ scsihw = var.scsihw
+ bootdisk = var.bootdisk
+
+ disks {
+ ide {
+ ide0 {
+ cloudinit {
+ storage = var.cloudinit_storage
+ }
+ }
+ }
+ virtio {
+ virtio0 {
+ disk {
+ storage = var.disk_storage
+ size = var.disk_size
+ iothread = var.iothread
+ replicate = var.replicate
+ }
+ }
+ }
+ }
+
+ network {
+ id = var.network_id
+ model = var.network_model
+ bridge = var.network_bridge
+ }
+
+ ipconfig0 = var.ipconfig0
+ ciuser = var.ciuser
+ sshkeys = var.sshkeys
+}
diff --git a/opentofu/modules/k8s_worker/outputs.tf b/opentofu/modules/k8s_worker/outputs.tf
new file mode 100644
index 0000000..c72c51e
--- /dev/null
+++ b/opentofu/modules/k8s_worker/outputs.tf
@@ -0,0 +1,3 @@
+output "vms" {
+ value = proxmox_vm_qemu.k8s_worker
+}
diff --git a/opentofu/modules/k8s_worker/variables.tf b/opentofu/modules/k8s_worker/variables.tf
new file mode 100644
index 0000000..1328088
--- /dev/null
+++ b/opentofu/modules/k8s_worker/variables.tf
@@ -0,0 +1,26 @@
+variable "vm_count" {}
+variable "name_prefix" {}
+variable "desc" {}
+variable "agent" {}
+variable "target_node" {}
+variable "tags" {}
+variable "clone" {}
+variable "full_clone" {}
+variable "qemu_os" {}
+variable "cores" {}
+variable "sockets" {}
+variable "cpu_type" {}
+variable "memory" {}
+variable "scsihw" {}
+variable "bootdisk" {}
+variable "cloudinit_storage" {}
+variable "disk_storage" {}
+variable "disk_size" {}
+variable "iothread" {}
+variable "replicate" {}
+variable "network_id" {}
+variable "network_model" {}
+variable "network_bridge" {}
+variable "ipconfig0" {}
+variable "ciuser" {}
+variable "sshkeys" {}
diff --git a/opentofu/modules/k8s_worker/versions.tf b/opentofu/modules/k8s_worker/versions.tf
new file mode 100644
index 0000000..d9656aa
--- /dev/null
+++ b/opentofu/modules/k8s_worker/versions.tf
@@ -0,0 +1,10 @@
+terraform {
+ required_version = ">= 1.8.0"
+
+ required_providers {
+ proxmox = {
+ source = "telmate/proxmox"
+ version = "3.0.1-rc6"
+ }
+ }
+}