commit f5b7fc63db0c48ef3787ca30a72f7d6176c8b411 Author: 1xtier Date: Mon Jan 12 01:24:58 2026 +0400 first commit diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..f4ce8d4 --- /dev/null +++ b/main.tf @@ -0,0 +1,25 @@ +resource "proxmox_lxc" "lxc" { + count = length(var.lxc) + ostemplate = "${var.images_lxc}" + password = "${var.lxc_auth.pass}" + target_node = var.lxc[count.index].nodes + unprivileged = var.lxc[count.index].unprivileged + ssh_public_keys = <<-EOT + ${var.lxc_auth.ssh_keys} + EOT + hostname = var.lxc[count.index].name + memory = var.lxc[count.index].mem + cores = var.lxc[count.index].cpus + nameserver = var.lxc[count.index].dns + + rootfs { + storage = var.lxc[count.index].pool + size = var.lxc[count.index].disks + } + network { + name = var.lxc[count.index].name + bridge = var.lxc[count.index].eth + ip = var.lxc[count.index].ip + ip6 = "auto" + } +} diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..e69de29 diff --git a/providers.tf b/providers.tf new file mode 100644 index 0000000..7f15582 --- /dev/null +++ b/providers.tf @@ -0,0 +1,7 @@ +provider "proxmox" { + pm_tls_insecure = true + pm_api_url = "" + pm_api_token_secret = "" + pm_api_token_id = "" + pm_otp = "" +} diff --git a/pve.auto.tfvars b/pve.auto.tfvars new file mode 100644 index 0000000..be859e1 --- /dev/null +++ b/pve.auto.tfvars @@ -0,0 +1,3 @@ +pve_api_url = "" +pve_api_token_id = "" +pve_api_token_secret = "" diff --git a/terraform.tfvars b/terraform.tfvars new file mode 100644 index 0000000..7633217 --- /dev/null +++ b/terraform.tfvars @@ -0,0 +1,18 @@ + +lxc_auth = { + ssh_keys = "" + pass = "" +} +lxc = [ + { + nodes = "" + name = "" + cpus = + mem = + pool = "" + disks = "" + eth = "" + ip = "" + unprivileged = true + } +] diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..75cf781 --- /dev/null +++ b/variables.tf @@ -0,0 +1,26 @@ +variable "images_lxc" { + type = string + default = "local:vztmpl/almalinux-9-default_20240911_amd64.tar.xz" +} +variable "lxc_auth" { + type = object({ + ssh_keys = string, + pass = string + }) +} +variable "lxc" { + description = "Parametrs lxc" + type = list(object({ + nodes = string, + name = string, + cpus = number, + mem = number, + pool = string, + disks = string, + eth = string, + ip = string, + unprivileged = bool + dns = number + }) + ) +} diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..b83031b --- /dev/null +++ b/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + proxmox = { + source = "telmate/proxmox" + version = "3.0.2" + } + } +}