Skip to content

Resource: proxmox_download_file

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.

Schema

Required

  • content_type (String) The file content type. Must be iso or import for VM images or vztmpl for 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 be md5 | sha1 | sha224 | sha256 | sha384 | sha512.
  • decompression_algorithm (String) Decompress the downloaded file using the specified compression algorithm. Must be one of gz | lzo | zst | bz2.
  • file_name (String) The file name. If not provided, it is calculated using url. PVE will raise 'wrong file extension' error for some popular extensions file .raw or .qcow2 on PVE versions prior to 8.4. Workaround is to use e.g. .img instead.
  • overwrite (Boolean) By default true. If true, 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). If false, no size checks are performed and the file is never automatically replaced.
  • overwrite_unmanaged (Boolean) If true and a file with the same name already exists in the datastore, it will be deleted and the new file will be downloaded. If false and the file already exists, an error will be returned.
  • upload_timeout (Number) The file download timeout seconds. Default is 600 (10min).
  • verify (Boolean) By default true. If false, no SSL/TLS certificates will be verified.

Read-Only

  • id (String) The unique identifier of this resource.
  • size (Number) The file size in PVE.