working and a bit modular

This commit is contained in:
jdn
2025-03-27 22:42:49 +01:00
commit 2df3f3636c
6 changed files with 214 additions and 0 deletions

58
tf_code/provisionning.tf Normal file
View File

@@ -0,0 +1,58 @@
resource "proxmox_virtual_environment_container" "container" {
for_each = var.unciel_eu
console {
enabled = true
type = "shell"
}
disk {
datastore_id = "local-lvm"
size = 4
}
initialization {
hostname = each.key
ip_config {
ipv4 {
address = "dhcp"
}
}
user_account {
keys = ["ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBACQkZ+kKXD4f/wSySiQMVEG9PwX0CBdPry8x3ilv35sjf81awhVaErcTJm+ZGTZ0ucunVjLlXKEf442d0HvNGkrMwB2ci+OCPQgyjKtN0KoItPFuRBEwo/V6PDjY6KOjUmw93ekOove3lp7LRn1bShmyya7blxZHJP0cIP4m4IDzvuzsA=="]
}
}
memory {
dedicated = each.value["memory"]
swap = each.value["memory"]
}
dynamic "mount_point" {
for_each = each.value["mount_points"]
content {
path = each.key
size = mount_point.value["size"]
volume = mount_point.value["volume"]
backup = true
}
}
network_interface {
name = "eth0"
}
node_name = "pxmx"
operating_system {
template_file_id = "local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
}
started = true
start_on_boot = true
tags = each.value.tags
unprivileged = true
vm_id = each.value.vm_id + 1000
}