Resource: proxmox_virtual_environment_download_file¶
Warning
Deprecated: Use proxmox_download_file instead. This resource will be removed in v1.0.
Manages files upload using PVE download-url API. It can be fully compatible and faster replacement for image files created using proxmox_virtual_environment_file. Supports images for VMs (ISO and disk images) and LXC (CT Templates).
Warning
Besides the Datastore.AllocateTemplate privilege, this resource requires both the Sys.Audit and Sys.Modify privileges.
For more details, see the download-url API documentation under the "Required permissions" section.
Info
The import content type is not enabled by default on Proxmox VE storages. To use this resource with content_type = "import", first add Import to the allowed content types on the target storage under 'Datacenter > Storage' in the Proxmox web interface.
Example Usage¶
resource "proxmox_virtual_environment_download_file" "release_20231228_debian_12_bookworm_qcow2_img" {
content_type = "iso"
datastore_id = "local"
file_name = "debian-12-generic-amd64-20231228-1609.img"
node_name = "pve"
url = "https://cloud.debian.org/images/cloud/bookworm/20231228-1609/debian-12-generic-amd64-20231228-1609.qcow2"
checksum = "d2fbcf11fb28795842e91364d8c7b69f1870db09ff299eb94e4fbbfa510eb78d141e74c1f4bf6dfa0b7e33d0c3b66e6751886feadb4e9916f778bab1776bdf1b"
checksum_algorithm = "sha512"
}
resource "proxmox_virtual_environment_download_file" "release_20231228_debian_12_bookworm_qcow2" {
content_type = "import"
datastore_id = "local"
file_name = "debian-12-generic-amd64-20231228-1609.qcow2"
node_name = "pve"
url = "https://cloud.debian.org/images/cloud/bookworm/20231228-1609/debian-12-generic-amd64-20231228-1609.qcow2"
checksum = "d2fbcf11fb28795842e91364d8c7b69f1870db09ff299eb94e4fbbfa510eb78d141e74c1f4bf6dfa0b7e33d0c3b66e6751886feadb4e9916f778bab1776bdf1b"
checksum_algorithm = "sha512"
}
resource "proxmox_virtual_environment_download_file" "latest_debian_12_bookworm_qcow2_img" {
content_type = "iso"
datastore_id = "local"
file_name = "debian-12-generic-amd64.qcow2.img"
node_name = "pve"
url = "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2"
}
resource "proxmox_virtual_environment_download_file" "latest_debian_12_bookworm_qcow2" {
content_type = "import"
datastore_id = "local"
file_name = "debian-12-generic-amd64.qcow2"
node_name = "pve"
url = "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2"
}
resource "proxmox_virtual_environment_download_file" "latest_ubuntu_22_jammy_qcow2_img" {
content_type = "iso"
datastore_id = "local"
node_name = "pve"
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
}
resource "proxmox_virtual_environment_download_file" "latest_static_ubuntu_24_noble_qcow2_img" {
content_type = "iso"
datastore_id = "local"
node_name = "pve"
url = "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img"
overwrite = false
}
resource "proxmox_virtual_environment_download_file" "release_20231211_ubuntu_22_jammy_lxc_img" {
content_type = "vztmpl"
datastore_id = "local"
node_name = "pve"
url = "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-amd64-root.tar.xz"
checksum = "c9997dcfea5d826fd04871f960c513665f2e87dd7450bba99f68a97e60e4586e"
checksum_algorithm = "sha256"
upload_timeout = 4444
}
resource "proxmox_virtual_environment_download_file" "latest_ubuntu_22_jammy_lxc_img" {
content_type = "vztmpl"
datastore_id = "local"
node_name = "pve"
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.tar.gz"
}
Schema¶
Required¶
content_type(String) The file content type. Must beisoorimportfor VM images orvztmplfor LXC images.datastore_id(String) The identifier for the target datastore.node_name(String) The node name.url(String) The URL to download the file from. Must match regex:https?://.*.
Optional¶
checksum(String) The expected checksum of the file.checksum_algorithm(String) The algorithm to calculate the checksum of the file. Must bemd5|sha1|sha224|sha256|sha384|sha512.decompression_algorithm(String) Decompress the downloaded file using the specified compression algorithm. Must be one ofgz|lzo|zst|bz2.file_name(String) The file name. If not provided, it is calculated usingurl. PVE will raise 'wrong file extension' error for some popular extensions file.rawor.qcow2on PVE versions prior to 8.4. Workaround is to use e.g..imginstead.overwrite(Boolean) By defaulttrue. Iftrue, the file will be replaced when either: (1) the file size in the datastore has changed outside of Terraform, or (2) the file size reported by the URL differs from the downloaded file (detecting upstream updates like new cloud image versions). Iffalse, no size checks are performed and the file is never automatically replaced.overwrite_unmanaged(Boolean) Iftrueand a file with the same name already exists in the datastore, it will be deleted and the new file will be downloaded. Iffalseand the file already exists, an error will be returned.upload_timeout(Number) The file download timeout seconds. Default is 600 (10min).verify(Boolean) By defaulttrue. Iffalse, no SSL/TLS certificates will be verified.