summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnricoGuccii <partyka.003@proton.me>2026-05-31 21:56:56 +0200
committerEnricoGuccii <partyka.003@proton.me>2026-05-31 21:56:56 +0200
commit1b883498b31c06447e122430f5c7d2786dd8cedf (patch)
treee12ce1768c584f83f8af113a43efd4be121bcd86
parentc93ac39447ba751be0a9817191f6636f10fbefc9 (diff)
terraform: works
-rw-r--r--terraform/main.tf60
-rw-r--r--terraform/planbin0 -> 4119 bytes
-rw-r--r--terraform/variables.tf45
3 files changed, 105 insertions, 0 deletions
diff --git a/terraform/main.tf b/terraform/main.tf
index e69de29..fc36c8b 100644
--- a/terraform/main.tf
+++ b/terraform/main.tf
@@ -0,0 +1,60 @@
+# Provider
+
+terraform {
+ required_providers {
+ proxmox = {
+ source = "bpg/proxmox"
+ version = "~> 0.83"
+ }
+ }
+}
+
+provider "proxmox" {
+ endpoint = var.proxmox_endpoint
+ api_token = var.proxmox_api_token
+
+ insecure = true
+}
+
+
+# LXC Container
+
+resource "proxmox_virtual_environment_container" "lxc01" {
+
+ vm_id = var.lxc_id
+ node_name = var.node_name
+
+
+ started = true
+
+ operating_system {
+ template_file_id = "local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst"
+ }
+
+ cpu {
+ cores = var.lxc_cores
+ }
+
+ memory {
+ dedicated = var.lxc_memory
+ swap = 512
+ }
+
+ disk {
+ datastore_id = "local-lvm"
+ size = 8
+ }
+
+ network_interface {
+ name = "eth0"
+ bridge = "vmbr0"
+ }
+
+ initialization {
+ hostname = var.lxc_name
+
+ user_account {
+ password = "Password123!"
+ }
+ }
+}
diff --git a/terraform/plan b/terraform/plan
new file mode 100644
index 0000000..65f9b8d
--- /dev/null
+++ b/terraform/plan
Binary files differ
diff --git a/terraform/variables.tf b/terraform/variables.tf
index e69de29..6610f25 100644
--- a/terraform/variables.tf
+++ b/terraform/variables.tf
@@ -0,0 +1,45 @@
+# Proxmox API
+
+variable "proxmox_endpoint" {
+ description = "Adres API Proxmox"
+ type = string
+ default = "https://pve:8006/api2/json"
+}
+
+variable "proxmox_api_token" {
+ description = "API Token user@realm!token=secret"
+ type = string
+ sensitive = true
+}
+
+
+# Node
+
+variable "node_name" {
+ description = "Nazwa node Proxmox"
+ type = string
+ default = "pve"
+}
+
+
+# LXC
+
+variable "lxc_id" {
+ type = number
+ default = 200
+}
+
+variable "lxc_name" {
+ type = string
+ default = "terraform-lxc"
+}
+
+variable "lxc_memory" {
+ type = number
+ default = 1024
+}
+
+variable "lxc_cores" {
+ type = number
+ default = 1
+}