aboutsummaryrefslogtreecommitdiff
path: root/opentofu/modules
diff options
context:
space:
mode:
Diffstat (limited to 'opentofu/modules')
-rw-r--r--opentofu/modules/ansible_provisioner/versions.tf11
-rw-r--r--opentofu/modules/k8s_control_plane/main.tf55
-rw-r--r--opentofu/modules/k8s_control_plane/outputs.tf3
-rw-r--r--opentofu/modules/k8s_control_plane/variables.tf25
-rw-r--r--opentofu/modules/k8s_control_plane/versions.tf11
-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
9 files changed, 200 insertions, 0 deletions
diff --git a/opentofu/modules/ansible_provisioner/versions.tf b/opentofu/modules/ansible_provisioner/versions.tf
new file mode 100644
index 0000000..d1135ae
--- /dev/null
+++ b/opentofu/modules/ansible_provisioner/versions.tf
@@ -0,0 +1,11 @@
+terraform {
+ required_version = ">= 1.8.0"
+
+ required_providers {
+ null = {
+ source = "hashicorp/null"
+ version = ">= 0.0.0"
+ }
+ }
+}
+
diff --git a/opentofu/modules/k8s_control_plane/main.tf b/opentofu/modules/k8s_control_plane/main.tf
new file mode 100644
index 0000000..d8477af
--- /dev/null
+++ b/opentofu/modules/k8s_control_plane/main.tf
@@ -0,0 +1,55 @@
+resource "proxmox_vm_qemu" "k8s_cp" {
+ lifecycle {
+ ignore_changes = [
+ bootdisk,
+ ]
+ }
+
+ name = var.name
+ 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_control_plane/outputs.tf b/opentofu/modules/k8s_control_plane/outputs.tf
new file mode 100644
index 0000000..a081907
--- /dev/null
+++ b/opentofu/modules/k8s_control_plane/outputs.tf
@@ -0,0 +1,3 @@
+output "vm" {
+ value = proxmox_vm_qemu.k8s_cp
+}
diff --git a/opentofu/modules/k8s_control_plane/variables.tf b/opentofu/modules/k8s_control_plane/variables.tf
new file mode 100644
index 0000000..e359f77
--- /dev/null
+++ b/opentofu/modules/k8s_control_plane/variables.tf
@@ -0,0 +1,25 @@
+variable "name" {}
+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_control_plane/versions.tf b/opentofu/modules/k8s_control_plane/versions.tf
new file mode 100644
index 0000000..07c0f16
--- /dev/null
+++ b/opentofu/modules/k8s_control_plane/versions.tf
@@ -0,0 +1,11 @@
+terraform {
+ required_version = ">= 1.8.0"
+
+ required_providers {
+ proxmox = {
+ source = "telmate/proxmox"
+ version = "3.0.1-rc6"
+ }
+ }
+}
+
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"
+ }
+ }
+}