mirror of
https://github.com/outbackdingo/homelab-v.git
synced 2026-08-25 14:53:19 +00:00
Picking sides No real functional change except the cute tofu icon in my IDE instead of the purple T
46 lines
1.0 KiB
HCL
46 lines
1.0 KiB
HCL
locals {
|
|
filename = "vm-${var.volume.vmid}-${var.volume.name}"
|
|
}
|
|
|
|
resource "restapi_object" "proxmox-volume" {
|
|
path = "/api2/json/nodes/${var.volume.node}/storage/${var.volume.storage}/content"
|
|
|
|
id_attribute = "data"
|
|
|
|
debug = true
|
|
|
|
data = jsonencode({
|
|
vmid = var.volume.vmid
|
|
filename = local.filename
|
|
size = var.volume.size
|
|
format = var.volume.format
|
|
})
|
|
|
|
// Proxmox returns a different object which we ignore.
|
|
// The size is also returned in bytes, not with prefix, e.g. 1G, 512Mi.
|
|
// Setting to false (default) triggers a change each run
|
|
ignore_all_server_changes = true
|
|
|
|
// Providing a supported parameter that doesn't do anything.
|
|
// Supplying either `null` or an empty object makes this fall back to the `data` object.
|
|
update_data = jsonencode({
|
|
node = var.volume.node
|
|
})
|
|
|
|
lifecycle {
|
|
prevent_destroy = false
|
|
}
|
|
}
|
|
|
|
output "node" {
|
|
value = var.volume.node
|
|
}
|
|
|
|
output "storage" {
|
|
value = var.volume.storage
|
|
}
|
|
|
|
output "filename" {
|
|
value = local.filename
|
|
}
|