homelab/opentofu/vms/s3.tf
2025-02-10 16:09:34 -03:00

56 lines
1 KiB
HCL

# docs: https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_container
variable "vm_names" {
type = list(string)
default = ["donkey-kong"]
}
resource "proxmox_virtual_environment_container" "vm" {
for_each = toset(var.vm_names)
vm_id = 160 + index(var.vm_names, each.key)
node_name = "pve"
description = "S3 data storage"
unprivileged = true
start_on_boot = "true"
disk {
datastore_id = "local-lvm"
size = 8
}
initialization {
hostname = each.key
ip_config {
ipv4 {
address = "10.0.10.${160 + index(var.vm_names, each.key)}/24"
gateway = "10.0.0.10"
}
}
user_account {
password = var.root_password
}
}
network_interface {
name = "eth0"
firewall = true
bridge = "vnet10"
}
operating_system {
template_file_id = "local:vztmpl/alpine-latest-base-2024-12-30.tar.gz"
type = "alpine"
}
tags = [
"storage",
"s3",
]
features {
nesting = true
}
}