diff --git a/infra/tofu/main.tf b/infra/tofu/main.tf index cf61a8d..cfa2f5d 100644 --- a/infra/tofu/main.tf +++ b/infra/tofu/main.tf @@ -40,7 +40,14 @@ locals { # OPERATOR ACTION: enable the "Import" content type on var.image_datastore (Datacenter # -> Storage -> local -> Content -> check "Import"), else the disk import fails with # "wrong type 'iso' - needs to be 'images' or 'import'". -resource "proxmox_virtual_environment_download_file" "debian_cloud_image" { +# +# Resource type is the SHORT name `proxmox_download_file` (bpg/proxmox ADR-007). The old +# `proxmox_virtual_environment_download_file` is deprecated ("Use `proxmox_download_file` +# instead. This resource will be removed in v1.0.") — both are the same dual-registered +# Framework resource, so the schema is identical. The `moved` block below migrates existing +# state in place (provider implements MoveState / migration.PrefixMoveState), so no +# re-download of the image and no change to the VMs. +resource "proxmox_download_file" "debian_cloud_image" { content_type = "import" datastore_id = var.image_datastore node_name = var.proxmox_node @@ -49,6 +56,15 @@ resource "proxmox_virtual_environment_download_file" "debian_cloud_image" { overwrite = false } +# State migration for the deprecated -> short resource-type rename (ADR-007). OpenTofu +# 1.9 (>= 1.8 required) drives the provider's MoveState RPC: the download_file state is +# transferred in place, keeping the same id (datastore_id:content_type/file_name), so the +# already-downloaded Debian image is NOT re-downloaded and the VMs' import_from is unchanged. +moved { + from = proxmox_virtual_environment_download_file.debian_cloud_image + to = proxmox_download_file.debian_cloud_image +} + # --- cloud-init: NATIVE Proxmox cloud-init only (API-driven) ------------------ # The rich first-boot baseline (packages, kernel modules, Longhorn disk, swap-off) # is NOT delivered as a custom snippet any more — custom snippets require SSH/SFTP @@ -102,7 +118,7 @@ resource "proxmox_virtual_environment_vm" "node" { # fs_setup/mount for /var/lib/longhorn already expects. disk { datastore_id = var.datastore - import_from = proxmox_virtual_environment_download_file.debian_cloud_image.id + import_from = proxmox_download_file.debian_cloud_image.id interface = "virtio0" size = var.os_disk_gib discard = "on"