mirror of
https://github.com/outbackdingo/homelab-v.git
synced 2026-08-25 14:53:19 +00:00
The .tfvars files are normally gitignored, but they serve as an example here. Just need to make sure I don't commit a secret... Inpired by #236
29 lines
747 B
Terraform
29 lines
747 B
Terraform
resource "null_resource" "haos_image" {
|
|
triggers = {
|
|
on_version_change = var.haos_version
|
|
filename = var.local_file
|
|
}
|
|
|
|
provisioner "local-exec" {
|
|
command = "curl -s -L ${var.haos_download_url}/${var.haos_version}/haos_ova-${var.haos_version}.qcow2.xz | xz -d > ${var.local_file}"
|
|
}
|
|
|
|
provisioner "local-exec" {
|
|
when = destroy
|
|
command = "rm ${self.triggers.filename}"
|
|
}
|
|
}
|
|
|
|
resource "proxmox_virtual_environment_file" "haos_generic_image" {
|
|
depends_on = [null_resource.haos_image]
|
|
node_name = var.proxmox_cluster.name
|
|
datastore_id = var.proxmox_cluster.image_datastore
|
|
|
|
content_type = "iso"
|
|
|
|
source_file {
|
|
path = var.local_file
|
|
file_name = "haos_ova-${var.haos_version}.img"
|
|
}
|
|
}
|