summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--main.tf39
2 files changed, 44 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fd2cee4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+terraform.tfstate
+terraform.tfstate.backup
+.terraform/
+.terraform.lock.hcl
+.terraform.tfstate.lock.info
diff --git a/main.tf b/main.tf
new file mode 100644
index 0000000..7a29dd1
--- /dev/null
+++ b/main.tf
@@ -0,0 +1,39 @@
+terraform {
+ required_providers {
+ proxmox = {
+ source = "telmate/proxmox"
+ version = ">=2.0.0"
+ }
+ }
+}
+
+provider "proxmox" {
+ # Configuration options
+ #pm_tls_insecure = true
+ pm_api_url = "https://pve.xlinfo.fr:8006/api2/json"
+ #pm_user = "root@pam"
+ #pm_password = "secret"
+ pm_api_token_id = "root@pam!terraform"
+ pm_api_token_secret = "a60b267c-5211-4090-bffd-12178f120840"
+}
+
+resource "proxmox_lxc" "basic" {
+ target_node = "pve"
+ hostname = "alpine"
+ ostemplate = "local:vztmpl/alpine-3.17-default_20221129_amd64.tar.xz"
+ password = "secret"
+ unprivileged = true
+ start = true
+
+ // Terraform will crash without rootfs defined
+ rootfs {
+ storage = "local-lvm"
+ size = "8G"
+ }
+
+ network {
+ name = "eth0"
+ bridge = "vmbr0"
+ ip = "dhcp"
+ }
+}