UNPKG

@muhlba91/pulumi-proxmoxve

Version:

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

263 lines (262 loc) 11.6 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.Storage.File`. 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. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as proxmoxve from "@muhlba91/pulumi-proxmoxve"; * * const release20231228Debian12BookwormQcow2Img = new proxmoxve.download.File("release20231228Debian12BookwormQcow2Img", { * checksum: "d2fbcf11fb28795842e91364d8c7b69f1870db09ff299eb94e4fbbfa510eb78d141e74c1f4bf6dfa0b7e33d0c3b66e6751886feadb4e9916f778bab1776bdf1b", * checksumAlgorithm: "sha512", * 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", * }); * const release20231228Debian12BookwormQcow2 = new proxmoxve.download.File("release20231228Debian12BookwormQcow2", { * checksum: "d2fbcf11fb28795842e91364d8c7b69f1870db09ff299eb94e4fbbfa510eb78d141e74c1f4bf6dfa0b7e33d0c3b66e6751886feadb4e9916f778bab1776bdf1b", * checksumAlgorithm: "sha512", * 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", * }); * const latestDebian12BookwormQcow2Img = new proxmoxve.download.File("latestDebian12BookwormQcow2Img", { * 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("latestDebian12BookwormQcow2", { * 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("latestUbuntu22JammyQcow2Img", { * 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("latestStaticUbuntu24NobleQcow2Img", { * contentType: "iso", * datastoreId: "local", * nodeName: "pve", * overwrite: false, * url: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img", * }); * const release20231211Ubuntu22JammyLxcImg = new proxmoxve.download.File("release20231211Ubuntu22JammyLxcImg", { * checksum: "c9997dcfea5d826fd04871f960c513665f2e87dd7450bba99f68a97e60e4586e", * checksumAlgorithm: "sha256", * contentType: "vztmpl", * datastoreId: "local", * nodeName: "pve", * uploadTimeout: 4444, * url: "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-amd64-root.tar.xz", * }); * const latestUbuntu22JammyLxcImg = new proxmoxve.download.File("latestUbuntu22JammyLxcImg", { * contentType: "vztmpl", * datastoreId: "local", * nodeName: "pve", * url: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.tar.gz", * }); * ``` */ 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` and file size has changed in the datastore, it will be replaced. If `false`, there will be no check. */ 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>; /** * The algorithm to calculate the checksum of the file. Must be `md5` | `sha1` | `sha224` | `sha256` | `sha384` | `sha512`. */ checksumAlgorithm?: pulumi.Input<string>; /** * 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>; /** * 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>; /** * The node name. */ nodeName?: pulumi.Input<string>; /** * By default `true`. If `true` and file size has changed in the datastore, it will be replaced. If `false`, there will be no check. */ overwrite?: pulumi.Input<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. */ overwriteUnmanaged?: pulumi.Input<boolean>; /** * The file size in PVE. */ size?: pulumi.Input<number>; /** * The file download timeout seconds. Default is 600 (10min). */ uploadTimeout?: pulumi.Input<number>; /** * 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>; } /** * The set of arguments for constructing a File resource. */ export interface FileArgs { /** * The expected checksum of the file. */ checksum?: pulumi.Input<string>; /** * The algorithm to calculate the checksum of the file. Must be `md5` | `sha1` | `sha224` | `sha256` | `sha384` | `sha512`. */ checksumAlgorithm?: pulumi.Input<string>; /** * 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>; /** * 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>; /** * The node name. */ nodeName: pulumi.Input<string>; /** * By default `true`. If `true` and file size has changed in the datastore, it will be replaced. If `false`, there will be no check. */ overwrite?: pulumi.Input<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. */ overwriteUnmanaged?: pulumi.Input<boolean>; /** * The file download timeout seconds. Default is 600 (10min). */ uploadTimeout?: pulumi.Input<number>; /** * 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>; }