Make VMs dynamic with for_each map — spin up/down any number by name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b8ce272610
commit
dad5376064
+10
-29
@@ -1,5 +1,5 @@
|
||||
variable "proxmox_api_token" {
|
||||
description = "Proxmox API token in the format user@realm!token_name=secret"
|
||||
description = "Proxmox API token — format: user@realm!token_name=secret"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
@@ -11,35 +11,16 @@ variable "ssh_private_key_path" {
|
||||
}
|
||||
|
||||
variable "ssh_public_key" {
|
||||
description = "SSH public key to inject into created VMs"
|
||||
description = "SSH public key injected into created VMs"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "vm_name" {
|
||||
description = "Name of the VM to create"
|
||||
type = string
|
||||
default = "debian-vm"
|
||||
}
|
||||
|
||||
variable "vm_id" {
|
||||
description = "Proxmox VM ID (100-999 for regular VMs)"
|
||||
type = number
|
||||
default = 100
|
||||
}
|
||||
|
||||
variable "vm_cores" {
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
|
||||
variable "vm_memory" {
|
||||
description = "Memory in MiB"
|
||||
type = number
|
||||
default = 2048
|
||||
}
|
||||
|
||||
variable "vm_disk_size" {
|
||||
description = "Disk size in GiB"
|
||||
type = number
|
||||
default = 20
|
||||
variable "vms" {
|
||||
description = "Map of VMs to create. Key becomes the VM hostname."
|
||||
type = map(object({
|
||||
cores = optional(number, 2)
|
||||
memory = optional(number, 2048)
|
||||
disk_size = optional(number, 20)
|
||||
}))
|
||||
default = {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user