UNPKG

@muhlba91/pulumi-proxmoxve

Version:

A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.

274 lines 13.1 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages files upload using PVE download-url API. It can be fully compatible and faster replacement for image files created using `proxmoxve.FileLegacy`. Supports images for VMs (ISO and disk images) and LXC (CT Templates). * * > Besides the `Datastore.AllocateTemplate` privilege, this resource requires both the `Sys.Audit` and `Sys.Modify` privileges.<br><br> * For more details, see the [`download-url`](https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/storage/{storage}/download-url) API documentation under the "Required permissions" section. * * > The `import` content type is not enabled by default on Proxmox VE storages. To use this resource with `contentType = "import"`, first add `Import` to the allowed content types on the target storage under 'Datacenter > Storage' in the Proxmox web interface. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as proxmoxve from "@muhlba91/pulumi-proxmoxve"; * * const release20231228Debian12BookwormQcow2Img = new proxmoxve.download.File("release_20231228_debian_12_bookworm_qcow2_img", { * contentType: "iso", * datastoreId: "local", * fileName: "debian-12-generic-amd64-20231228-1609.img", * nodeName: "pve", * url: "https://cloud.debian.org/images/cloud/bookworm/20231228-1609/debian-12-generic-amd64-20231228-1609.qcow2", * checksum: "d2fbcf11fb28795842e91364d8c7b69f1870db09ff299eb94e4fbbfa510eb78d141e74c1f4bf6dfa0b7e33d0c3b66e6751886feadb4e9916f778bab1776bdf1b", * checksumAlgorithm: "sha512", * }); * const release20231228Debian12BookwormQcow2 = new proxmoxve.download.File("release_20231228_debian_12_bookworm_qcow2", { * contentType: "import", * datastoreId: "local", * fileName: "debian-12-generic-amd64-20231228-1609.qcow2", * nodeName: "pve", * url: "https://cloud.debian.org/images/cloud/bookworm/20231228-1609/debian-12-generic-amd64-20231228-1609.qcow2", * checksum: "d2fbcf11fb28795842e91364d8c7b69f1870db09ff299eb94e4fbbfa510eb78d141e74c1f4bf6dfa0b7e33d0c3b66e6751886feadb4e9916f778bab1776bdf1b", * checksumAlgorithm: "sha512", * }); * const latestDebian12BookwormQcow2Img = new proxmoxve.download.File("latest_debian_12_bookworm_qcow2_img", { * contentType: "iso", * datastoreId: "local", * fileName: "debian-12-generic-amd64.qcow2.img", * nodeName: "pve", * url: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2", * }); * const latestDebian12BookwormQcow2 = new proxmoxve.download.File("latest_debian_12_bookworm_qcow2", { * contentType: "import", * datastoreId: "local", * fileName: "debian-12-generic-amd64.qcow2", * nodeName: "pve", * url: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2", * }); * const latestUbuntu22JammyQcow2Img = new proxmoxve.download.File("latest_ubuntu_22_jammy_qcow2_img", { * contentType: "iso", * datastoreId: "local", * nodeName: "pve", * url: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img", * }); * const latestStaticUbuntu24NobleQcow2Img = new proxmoxve.download.File("latest_static_ubuntu_24_noble_qcow2_img", { * contentType: "iso", * datastoreId: "local", * nodeName: "pve", * url: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img", * overwrite: false, * }); * const release20231211Ubuntu22JammyLxcImg = new proxmoxve.download.File("release_20231211_ubuntu_22_jammy_lxc_img", { * contentType: "vztmpl", * datastoreId: "local", * nodeName: "pve", * url: "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-amd64-root.tar.xz", * checksum: "c9997dcfea5d826fd04871f960c513665f2e87dd7450bba99f68a97e60e4586e", * checksumAlgorithm: "sha256", * uploadTimeout: 4444, * }); * const latestUbuntu22JammyLxcImg = new proxmoxve.download.File("latest_ubuntu_22_jammy_lxc_img", { * contentType: "vztmpl", * datastoreId: "local", * nodeName: "pve", * url: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.tar.gz", * }); * ``` * * ## Import * * !/usr/bin/env sh * A download file can be imported using its identifier in the format: node_name/datastore_id:content_type/file_name, e.g.: * * ```sh * $ pulumi import proxmoxve:download/file:File ubuntu_iso pve/local:iso/ubuntu-24.04-server.iso * ``` */ export declare class File extends pulumi.CustomResource { /** * Get an existing File resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: FileState, opts?: pulumi.CustomResourceOptions): File; /** * Returns true if the given object is an instance of File. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is File; /** * The expected checksum of the file. */ readonly checksum: pulumi.Output<string | undefined>; /** * The algorithm to calculate the checksum of the file. Must be `md5` | `sha1` | `sha224` | `sha256` | `sha384` | `sha512`. */ readonly checksumAlgorithm: pulumi.Output<string | undefined>; /** * The file content type. Must be `iso` or `import` for VM images or `vztmpl` for LXC images. */ readonly contentType: pulumi.Output<string>; /** * The identifier for the target datastore. */ readonly datastoreId: pulumi.Output<string>; /** * Decompress the downloaded file using the specified compression algorithm. Must be one of `gz` | `lzo` | `zst` | `bz2`. */ readonly decompressionAlgorithm: pulumi.Output<string | undefined>; /** * 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. */ readonly fileName: pulumi.Output<string>; /** * The node name. */ readonly nodeName: pulumi.Output<string>; /** * 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. */ readonly overwrite: pulumi.Output<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. */ readonly overwriteUnmanaged: pulumi.Output<boolean>; /** * The file size in PVE. */ readonly size: pulumi.Output<number>; /** * The file download timeout seconds. Default is 600 (10min). */ readonly uploadTimeout: pulumi.Output<number>; /** * The URL to download the file from. Must match regex: `https?://.*`. */ readonly url: pulumi.Output<string>; /** * By default `true`. If `false`, no SSL/TLS certificates will be verified. */ readonly verify: pulumi.Output<boolean>; /** * Create a File resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: FileArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering File resources. */ export interface FileState { /** * The expected checksum of the file. */ checksum?: pulumi.Input<string | undefined>; /** * The algorithm to calculate the checksum of the file. Must be `md5` | `sha1` | `sha224` | `sha256` | `sha384` | `sha512`. */ checksumAlgorithm?: pulumi.Input<string | undefined>; /** * The file content type. Must be `iso` or `import` for VM images or `vztmpl` for LXC images. */ contentType?: pulumi.Input<string | undefined>; /** * The identifier for the target datastore. */ datastoreId?: pulumi.Input<string | undefined>; /** * Decompress the downloaded file using the specified compression algorithm. Must be one of `gz` | `lzo` | `zst` | `bz2`. */ decompressionAlgorithm?: pulumi.Input<string | undefined>; /** * 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. */ fileName?: pulumi.Input<string | undefined>; /** * The node name. */ nodeName?: pulumi.Input<string | undefined>; /** * 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?: pulumi.Input<boolean | undefined>; /** * 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. */ overwriteUnmanaged?: pulumi.Input<boolean | undefined>; /** * The file size in PVE. */ size?: pulumi.Input<number | undefined>; /** * The file download timeout seconds. Default is 600 (10min). */ uploadTimeout?: pulumi.Input<number | undefined>; /** * The URL to download the file from. Must match regex: `https?://.*`. */ url?: pulumi.Input<string | undefined>; /** * By default `true`. If `false`, no SSL/TLS certificates will be verified. */ verify?: pulumi.Input<boolean | undefined>; } /** * The set of arguments for constructing a File resource. */ export interface FileArgs { /** * The expected checksum of the file. */ checksum?: pulumi.Input<string | undefined>; /** * The algorithm to calculate the checksum of the file. Must be `md5` | `sha1` | `sha224` | `sha256` | `sha384` | `sha512`. */ checksumAlgorithm?: pulumi.Input<string | undefined>; /** * The file content type. Must be `iso` or `import` for VM images or `vztmpl` for LXC images. */ contentType: pulumi.Input<string>; /** * The identifier for the target datastore. */ datastoreId: pulumi.Input<string>; /** * Decompress the downloaded file using the specified compression algorithm. Must be one of `gz` | `lzo` | `zst` | `bz2`. */ decompressionAlgorithm?: pulumi.Input<string | undefined>; /** * 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. */ fileName?: pulumi.Input<string | undefined>; /** * The node name. */ nodeName: pulumi.Input<string>; /** * 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?: pulumi.Input<boolean | undefined>; /** * 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. */ overwriteUnmanaged?: pulumi.Input<boolean | undefined>; /** * The file download timeout seconds. Default is 600 (10min). */ uploadTimeout?: pulumi.Input<number | undefined>; /** * The URL to download the file from. Must match regex: `https?://.*`. */ url: pulumi.Input<string>; /** * By default `true`. If `false`, no SSL/TLS certificates will be verified. */ verify?: pulumi.Input<boolean | undefined>; } //# sourceMappingURL=file.d.ts.map