@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
292 lines (291 loc) • 10.4 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Use this resource to upload files to a Proxmox VE node. The file can be a backup, an ISO image, a Disk Image, a snippet, or a container template depending on the `contentType` attribute.
*
* ## Example Usage
*
* ### Backups (`backup`)
*
* > The resource with this content type uses SSH access to the node. You might need to configure the `ssh` option in the `provider` section.
*
* > The provider currently does not support restoring backups. You can use the Proxmox VE web interface or the `qmrestore` / `pct restore` command to restore VM / Container from a backup.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const backup = new proxmoxve.storage.File("backup", {
* contentType: "backup",
* datastoreId: "local",
* nodeName: "pve",
* sourceFile: {
* path: "vzdump-lxc-100-2023_11_08-23_10_05.tar.zst",
* },
* });
* ```
*
* ### Images
*
* > Consider using `proxmoxve.Download.File` resource instead. Using this resource for images is less efficient (requires to transfer uploaded image to node) though still supported.
*
* > Importing Disks is not enabled by default in new Proxmox installations. You need to enable them in the 'Datacenter>Storage' section of the proxmox interface before first using this resource with `contentType = "import"`.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const ubuntuContainerTemplate = new proxmoxve.storage.File("ubuntuContainerTemplate", {
* contentType: "iso",
* datastoreId: "local",
* nodeName: "pve",
* sourceFile: {
* path: "https://cloud-images.ubuntu.com/jammy/20230929/jammy-server-cloudimg-amd64-disk-kvm.img",
* },
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const ubuntuContainerTemplate = new proxmoxve.storage.File("ubuntuContainerTemplate", {
* contentType: "import",
* datastoreId: "local",
* nodeName: "pve",
* sourceFile: {
* path: "https://cloud-images.ubuntu.com/jammy/20230929/jammy-server-cloudimg-amd64-disk-kvm.img",
* },
* });
* ```
*
* ### Container Template (`vztmpl`)
*
* > Consider using `proxmoxve.Download.File` resource instead. Using this resource for container images is less efficient (requires to transfer uploaded image to node) though still supported.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const ubuntuContainerTemplate = new proxmoxve.storage.File("ubuntuContainerTemplate", {
* contentType: "vztmpl",
* datastoreId: "local",
* nodeName: "first-node",
* sourceFile: {
* path: "http://download.proxmox.com/images/system/ubuntu-20.04-standard_20.04-1_amd64.tar.gz",
* },
* });
* ```
*
* ## Important Notes
*
* The Proxmox VE API endpoint for file uploads does not support chunked transfer
* encoding, which means that we must first store the source file as a temporary
* file locally before uploading it.
*
* You must ensure that you have at least `Size-in-MB * 2 + 1` MB of storage space
* available (twice the size plus overhead because a multipart payload needs to be
* created as another temporary file).
*
* By default, if the specified file already exists, the resource will
* unconditionally replace it and take ownership of the resource. On destruction,
* the file will be deleted as if it did not exist before. If you want to prevent
* the resource from replacing the file, set `overwrite` to `false`.
*
* ## Import
*
* Instances can be imported using the `node_name`, `datastore_id`, `content_type`
*
* and the `file_name` in the following format:
*
* text
*
* node_name:datastore_id/content_type/file_name
*
* Example:
*
* bash
*
* ```sh
* $ pulumi import proxmoxve:Storage/file:File cloud_config pve/local:snippets/example.cloud-config.yaml
* ```
*/
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 content type. If not specified, the content
* type will be inferred from the file extension. Valid values are:
*/
readonly contentType: pulumi.Output<string>;
/**
* The datastore id.
*/
readonly datastoreId: pulumi.Output<string>;
/**
* The file mode in octal format, e.g. `0700` or `600`. Note that the prefixes `0o` and `0x` is not supported! Setting this attribute is also only allowed for `root@pam` authenticated user.
*/
readonly fileMode: pulumi.Output<string | undefined>;
/**
* The file modification date (RFC 3339).
*/
readonly fileModificationDate: pulumi.Output<string>;
/**
* The file name.
*/
readonly fileName: pulumi.Output<string>;
/**
* The file size in bytes.
*/
readonly fileSize: pulumi.Output<number>;
/**
* The file tag.
*/
readonly fileTag: pulumi.Output<string>;
/**
* The node name.
*/
readonly nodeName: pulumi.Output<string>;
/**
* Whether to overwrite an existing file (defaults to
* `true`).
*/
readonly overwrite: pulumi.Output<boolean | undefined>;
/**
* The source file (conflicts with `sourceRaw`),
* could be a local file or a URL. If the source file is a URL, the file will
* be downloaded and stored locally before uploading it to Proxmox VE.
*/
readonly sourceFile: pulumi.Output<outputs.Storage.FileSourceFile | undefined>;
/**
* The raw source (conflicts with `sourceFile`).
*/
readonly sourceRaw: pulumi.Output<outputs.Storage.FileSourceRaw | undefined>;
/**
* Timeout for uploading ISO/VSTMPL files in
* seconds (defaults to 1800).
*/
readonly timeoutUpload: pulumi.Output<number | undefined>;
/**
* 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 content type. If not specified, the content
* type will be inferred from the file extension. Valid values are:
*/
contentType?: pulumi.Input<string>;
/**
* The datastore id.
*/
datastoreId?: pulumi.Input<string>;
/**
* The file mode in octal format, e.g. `0700` or `600`. Note that the prefixes `0o` and `0x` is not supported! Setting this attribute is also only allowed for `root@pam` authenticated user.
*/
fileMode?: pulumi.Input<string>;
/**
* The file modification date (RFC 3339).
*/
fileModificationDate?: pulumi.Input<string>;
/**
* The file name.
*/
fileName?: pulumi.Input<string>;
/**
* The file size in bytes.
*/
fileSize?: pulumi.Input<number>;
/**
* The file tag.
*/
fileTag?: pulumi.Input<string>;
/**
* The node name.
*/
nodeName?: pulumi.Input<string>;
/**
* Whether to overwrite an existing file (defaults to
* `true`).
*/
overwrite?: pulumi.Input<boolean>;
/**
* The source file (conflicts with `sourceRaw`),
* could be a local file or a URL. If the source file is a URL, the file will
* be downloaded and stored locally before uploading it to Proxmox VE.
*/
sourceFile?: pulumi.Input<inputs.Storage.FileSourceFile>;
/**
* The raw source (conflicts with `sourceFile`).
*/
sourceRaw?: pulumi.Input<inputs.Storage.FileSourceRaw>;
/**
* Timeout for uploading ISO/VSTMPL files in
* seconds (defaults to 1800).
*/
timeoutUpload?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a File resource.
*/
export interface FileArgs {
/**
* The content type. If not specified, the content
* type will be inferred from the file extension. Valid values are:
*/
contentType?: pulumi.Input<string>;
/**
* The datastore id.
*/
datastoreId: pulumi.Input<string>;
/**
* The file mode in octal format, e.g. `0700` or `600`. Note that the prefixes `0o` and `0x` is not supported! Setting this attribute is also only allowed for `root@pam` authenticated user.
*/
fileMode?: pulumi.Input<string>;
/**
* The node name.
*/
nodeName: pulumi.Input<string>;
/**
* Whether to overwrite an existing file (defaults to
* `true`).
*/
overwrite?: pulumi.Input<boolean>;
/**
* The source file (conflicts with `sourceRaw`),
* could be a local file or a URL. If the source file is a URL, the file will
* be downloaded and stored locally before uploading it to Proxmox VE.
*/
sourceFile?: pulumi.Input<inputs.Storage.FileSourceFile>;
/**
* The raw source (conflicts with `sourceFile`).
*/
sourceRaw?: pulumi.Input<inputs.Storage.FileSourceRaw>;
/**
* Timeout for uploading ISO/VSTMPL files in
* seconds (defaults to 1800).
*/
timeoutUpload?: pulumi.Input<number>;
}