@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
644 lines • 25.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Manages an LXC container on a Proxmox VE node.
*
* A container's root filesystem (the `disk` block) and any additional volumes
* (`mountPoint` blocks) can be placed on any Proxmox VE storage backend —
* directory, LVM, LVM-thin, ZFS, Ceph RBD, NFS, CIFS, or any other storage
* configured on the cluster. Bind mounts of arbitrary host directories are
* also supported. See the Storage section below for details.
*
* ## Example Usage
*
* ### Basic container
*
* A minimal Ubuntu container with a 4 GB rootfs on `local-lvm`,
* DHCP networking, and an SSH key:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
* import * as random from "@pulumi/random";
* import * as std from "@pulumi/std";
* import * as tls from "@pulumi/tls";
*
* export = async () => {
* const ubuntu2504LxcImg = new proxmoxve.download.FileLegacy("ubuntu_2504_lxc_img", {
* contentType: "vztmpl",
* datastoreId: "local",
* nodeName: "first-node",
* url: "https://mirrors.servercentral.com/ubuntu-cloud-images/releases/25.04/release/ubuntu-25.04-server-cloudimg-amd64-root.tar.xz",
* });
* const ubuntuContainerPassword = new random.RandomPassword("ubuntu_container_password", {
* length: 16,
* overrideSpecial: "_%@",
* special: true,
* });
* const ubuntuContainerKey = new tls.PrivateKey("ubuntu_container_key", {
* algorithm: "RSA",
* rsaBits: 2048,
* });
* const ubuntuContainer = new proxmoxve.ContainerLegacy("ubuntu_container", {
* description: "Managed by Pulumi",
* nodeName: "first-node",
* vmId: 1234,
* unprivileged: true,
* features: {
* nesting: true,
* },
* initialization: {
* hostname: "terraform-provider-proxmox-ubuntu-container",
* ipConfigs: [{
* ipv4: {
* address: "dhcp",
* },
* }],
* userAccount: {
* keys: [std.trimspaceOutput({
* input: ubuntuContainerKey.publicKeyOpenssh,
* }).apply(invoke => invoke.result)],
* password: ubuntuContainerPassword.result,
* },
* },
* networkInterfaces: [{
* name: "veth0",
* }],
* disk: {
* datastoreId: "local-lvm",
* size: 4,
* },
* operatingSystem: {
* templateFileId: ubuntu2504LxcImg.id,
* type: "ubuntu",
* },
* startup: {
* order: 3,
* upDelay: 60,
* downDelay: 60,
* },
* });
* return {
* ubuntuContainerPassword: ubuntuContainerPassword.result,
* ubuntuContainerPrivateKey: ubuntuContainerKey.privateKeyPem,
* ubuntuContainerPublicKey: ubuntuContainerKey.publicKeyOpenssh,
* };
* }
* ```
*
* ### Custom storage configuration
*
* This example places the rootfs on a custom storage pool, attaches an
* additional volume, mounts an existing volume by ID, and bind-mounts a host
* directory. Any Proxmox storage backend (directory, LVM-thin, ZFS, Ceph RBD,
* NFS, CIFS) can be referenced by its storage ID:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const customStorage = new proxmoxve.ContainerLegacy("custom_storage", {
* nodeName: "first-node",
* vmId: 1235,
* disk: {
* datastoreId: "tank-zfs",
* size: 32,
* },
* mountPoints: [
* {
* volume: "local-lvm",
* size: "10G",
* path: "/mnt/volume",
* },
* {
* volume: "local-lvm:subvol-108-disk-101",
* size: "10G",
* path: "/mnt/data",
* },
* {
* volume: "/mnt/bindmounts/shared",
* path: "/mnt/shared",
* },
* ],
* });
* ```
*
* ## Storage
*
* Containers attach storage through two block types:
*
* - **`disk`** — the root filesystem (rootfs). Exactly one rootfs per
* container; the `datastoreId` argument selects the Proxmox storage pool
* it lives on.
* - **`mountPoint`** — zero or more additional volumes or bind mounts,
* each mounted at a separate `path` inside the container.
*
* Both block types are backend-agnostic: `datastoreId` (on `disk`) and
* `volume` (on `mountPoint`) accept any Proxmox storage ID, regardless of
* backend type. Run `pvesm status` on the host or use the
* `proxmoxve.getDatastoresLegacy`
* data source to list configured storages.
*
* The `mount_point.volume` attribute accepts three forms:
*
* | Form | Meaning | Example |
* | -------------------------- | -------------------------------------------------------- | ---------------------------------- |
* | Storage ID | Allocate a new volume on that storage (requires `size`) | `local-lvm`, `tank-zfs` |
* | Storage ID + volume name | Mount an existing volume by its full PVE volume ID | `local-lvm:subvol-108-disk-101` |
* | Absolute host path | Bind-mount a host directory (requires `root@pam` auth) | `/mnt/bindmounts/shared` |
*
* ## Import
*
* Instances can be imported using the `nodeName` and the `vmId`, e.g.,
*
* ```sh
* $ pulumi import proxmoxve:index/containerLegacy:ContainerLegacy ubuntu_container first-node/1234
* ```
*/
export declare class ContainerLegacy extends pulumi.CustomResource {
/**
* Get an existing ContainerLegacy 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?: ContainerLegacyState, opts?: pulumi.CustomResourceOptions): ContainerLegacy;
/**
* Returns true if the given object is an instance of ContainerLegacy. 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 ContainerLegacy;
/**
* The cloning configuration.
*/
readonly clone: pulumi.Output<outputs.ContainerLegacyClone | undefined>;
/**
* The console configuration.
*/
readonly console: pulumi.Output<outputs.ContainerLegacyConsole | undefined>;
/**
* The CPU configuration.
*/
readonly cpu: pulumi.Output<outputs.ContainerLegacyCpu | undefined>;
/**
* The description.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Device to pass through to the container (multiple blocks supported).
*/
readonly devicePassthroughs: pulumi.Output<outputs.ContainerLegacyDevicePassthrough[] | undefined>;
/**
* The root filesystem (rootfs) storage configuration.
* Selects the Proxmox storage pool the container's root volume is created
* on. Backend-agnostic — works with directory, LVM, LVM-thin, ZFS, Ceph
* RBD, NFS, and any other configured Proxmox storage.
*/
readonly disk: pulumi.Output<outputs.ContainerLegacyDisk | undefined>;
/**
* A map of runtime environment variables for the container init process.
*/
readonly environmentVariables: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* The container feature flags. Changing flags (except nesting) is only allowed for `root@pam` authenticated user.
*/
readonly features: pulumi.Output<outputs.ContainerLegacyFeatures | undefined>;
/**
* The identifier for a file containing a hook script (needs to be executable, e.g. by using the `proxmox_virtual_environment_file.file_mode` attribute).
*/
readonly hookScriptFileId: pulumi.Output<string | undefined>;
/**
* UID/GID mapping for unprivileged containers (multiple
* blocks supported). These are written as `lxc.idmap` entries in the container
* configuration file via SSH, since the Proxmox API does not support writing
* `lxc[n]` parameters.
*/
readonly idmaps: pulumi.Output<outputs.ContainerLegacyIdmap[] | undefined>;
/**
* The initialization configuration.
*/
readonly initialization: pulumi.Output<outputs.ContainerLegacyInitialization | undefined>;
/**
* The map of IPv4 addresses per network devices. Returns the first address for each network device, if multiple addresses are assigned.
*/
readonly ipv4: pulumi.Output<{
[key: string]: string;
}>;
/**
* The map of IPv6 addresses per network device. Returns the first address for each network device, if multiple addresses are assigned.
*/
readonly ipv6: pulumi.Output<{
[key: string]: string;
}>;
/**
* The memory configuration.
*/
readonly memory: pulumi.Output<outputs.ContainerLegacyMemory | undefined>;
/**
* An additional volume mount or host bind mount
* (multiple blocks supported). Use this for data volumes, shared
* directories, or attaching pre-existing PVE volumes.
*/
readonly mountPoints: pulumi.Output<outputs.ContainerLegacyMountPoint[] | undefined>;
/**
* A network interface (multiple blocks
* supported).
*/
readonly networkInterfaces: pulumi.Output<outputs.ContainerLegacyNetworkInterface[] | undefined>;
/**
* The name of the node to assign the container to.
*/
readonly nodeName: pulumi.Output<string>;
/**
* The Operating System configuration.
*/
readonly operatingSystem: pulumi.Output<outputs.ContainerLegacyOperatingSystem | undefined>;
/**
* The identifier for a pool to assign the container to.
*/
readonly poolId: pulumi.Output<string | undefined>;
/**
* Whether to set the protection flag of the container (defaults to `false`). This will prevent the container itself and its disk for remove/update operations.
*/
readonly protection: pulumi.Output<boolean | undefined>;
/**
* Automatically start container when the host
* system boots (defaults to `true`).
*/
readonly startOnBoot: pulumi.Output<boolean | undefined>;
/**
* Whether to start the container (defaults to `true`).
*/
readonly started: pulumi.Output<boolean | undefined>;
/**
* Defines startup and shutdown behavior of the container.
*/
readonly startup: pulumi.Output<outputs.ContainerLegacyStartup | undefined>;
/**
* A list of tags the container tags. This is only meta
* information (defaults to `[]`). Note: Proxmox always sorts the container tags and set them to lowercase.
* If tag contains capital letters, then Proxmox will always report a
* difference on the resource. You may use the `ignoreChanges` lifecycle
* meta-argument to ignore changes to this attribute.
*/
readonly tags: pulumi.Output<string[] | undefined>;
/**
* Whether to create a template (defaults to `false`).
*/
readonly template: pulumi.Output<boolean | undefined>;
/**
* Timeout for cloning a container in seconds (defaults to 1800).
*/
readonly timeoutClone: pulumi.Output<number | undefined>;
/**
* Timeout for creating a container in seconds (defaults to 1800).
*/
readonly timeoutCreate: pulumi.Output<number | undefined>;
/**
* Timeout for deleting a container in seconds (defaults to 60).
*/
readonly timeoutDelete: pulumi.Output<number | undefined>;
/**
* Start container timeout
*
* @deprecated This field is deprecated and will be removed in a future release. An overall operation timeout (`timeoutCreate` / `timeoutClone`) is used instead.
*/
readonly timeoutStart: pulumi.Output<number | undefined>;
/**
* Timeout for updating a container in seconds (defaults to 1800).
*/
readonly timeoutUpdate: pulumi.Output<number | undefined>;
/**
* Whether the container runs as unprivileged on the host (defaults to `false`).
*/
readonly unprivileged: pulumi.Output<boolean | undefined>;
/**
* The container identifier
*/
readonly vmId: pulumi.Output<number>;
/**
* Configuration for waiting for specific IP address types when the container starts.
*/
readonly waitForIp: pulumi.Output<outputs.ContainerLegacyWaitForIp | undefined>;
/**
* Create a ContainerLegacy 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: ContainerLegacyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ContainerLegacy resources.
*/
export interface ContainerLegacyState {
/**
* The cloning configuration.
*/
clone?: pulumi.Input<inputs.ContainerLegacyClone | undefined>;
/**
* The console configuration.
*/
console?: pulumi.Input<inputs.ContainerLegacyConsole | undefined>;
/**
* The CPU configuration.
*/
cpu?: pulumi.Input<inputs.ContainerLegacyCpu | undefined>;
/**
* The description.
*/
description?: pulumi.Input<string | undefined>;
/**
* Device to pass through to the container (multiple blocks supported).
*/
devicePassthroughs?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyDevicePassthrough>[] | undefined>;
/**
* The root filesystem (rootfs) storage configuration.
* Selects the Proxmox storage pool the container's root volume is created
* on. Backend-agnostic — works with directory, LVM, LVM-thin, ZFS, Ceph
* RBD, NFS, and any other configured Proxmox storage.
*/
disk?: pulumi.Input<inputs.ContainerLegacyDisk | undefined>;
/**
* A map of runtime environment variables for the container init process.
*/
environmentVariables?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* The container feature flags. Changing flags (except nesting) is only allowed for `root@pam` authenticated user.
*/
features?: pulumi.Input<inputs.ContainerLegacyFeatures | undefined>;
/**
* The identifier for a file containing a hook script (needs to be executable, e.g. by using the `proxmox_virtual_environment_file.file_mode` attribute).
*/
hookScriptFileId?: pulumi.Input<string | undefined>;
/**
* UID/GID mapping for unprivileged containers (multiple
* blocks supported). These are written as `lxc.idmap` entries in the container
* configuration file via SSH, since the Proxmox API does not support writing
* `lxc[n]` parameters.
*/
idmaps?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyIdmap>[] | undefined>;
/**
* The initialization configuration.
*/
initialization?: pulumi.Input<inputs.ContainerLegacyInitialization | undefined>;
/**
* The map of IPv4 addresses per network devices. Returns the first address for each network device, if multiple addresses are assigned.
*/
ipv4?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* The map of IPv6 addresses per network device. Returns the first address for each network device, if multiple addresses are assigned.
*/
ipv6?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* The memory configuration.
*/
memory?: pulumi.Input<inputs.ContainerLegacyMemory | undefined>;
/**
* An additional volume mount or host bind mount
* (multiple blocks supported). Use this for data volumes, shared
* directories, or attaching pre-existing PVE volumes.
*/
mountPoints?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyMountPoint>[] | undefined>;
/**
* A network interface (multiple blocks
* supported).
*/
networkInterfaces?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyNetworkInterface>[] | undefined>;
/**
* The name of the node to assign the container to.
*/
nodeName?: pulumi.Input<string | undefined>;
/**
* The Operating System configuration.
*/
operatingSystem?: pulumi.Input<inputs.ContainerLegacyOperatingSystem | undefined>;
/**
* The identifier for a pool to assign the container to.
*/
poolId?: pulumi.Input<string | undefined>;
/**
* Whether to set the protection flag of the container (defaults to `false`). This will prevent the container itself and its disk for remove/update operations.
*/
protection?: pulumi.Input<boolean | undefined>;
/**
* Automatically start container when the host
* system boots (defaults to `true`).
*/
startOnBoot?: pulumi.Input<boolean | undefined>;
/**
* Whether to start the container (defaults to `true`).
*/
started?: pulumi.Input<boolean | undefined>;
/**
* Defines startup and shutdown behavior of the container.
*/
startup?: pulumi.Input<inputs.ContainerLegacyStartup | undefined>;
/**
* A list of tags the container tags. This is only meta
* information (defaults to `[]`). Note: Proxmox always sorts the container tags and set them to lowercase.
* If tag contains capital letters, then Proxmox will always report a
* difference on the resource. You may use the `ignoreChanges` lifecycle
* meta-argument to ignore changes to this attribute.
*/
tags?: pulumi.Input<pulumi.Input<string>[] | undefined>;
/**
* Whether to create a template (defaults to `false`).
*/
template?: pulumi.Input<boolean | undefined>;
/**
* Timeout for cloning a container in seconds (defaults to 1800).
*/
timeoutClone?: pulumi.Input<number | undefined>;
/**
* Timeout for creating a container in seconds (defaults to 1800).
*/
timeoutCreate?: pulumi.Input<number | undefined>;
/**
* Timeout for deleting a container in seconds (defaults to 60).
*/
timeoutDelete?: pulumi.Input<number | undefined>;
/**
* Start container timeout
*
* @deprecated This field is deprecated and will be removed in a future release. An overall operation timeout (`timeoutCreate` / `timeoutClone`) is used instead.
*/
timeoutStart?: pulumi.Input<number | undefined>;
/**
* Timeout for updating a container in seconds (defaults to 1800).
*/
timeoutUpdate?: pulumi.Input<number | undefined>;
/**
* Whether the container runs as unprivileged on the host (defaults to `false`).
*/
unprivileged?: pulumi.Input<boolean | undefined>;
/**
* The container identifier
*/
vmId?: pulumi.Input<number | undefined>;
/**
* Configuration for waiting for specific IP address types when the container starts.
*/
waitForIp?: pulumi.Input<inputs.ContainerLegacyWaitForIp | undefined>;
}
/**
* The set of arguments for constructing a ContainerLegacy resource.
*/
export interface ContainerLegacyArgs {
/**
* The cloning configuration.
*/
clone?: pulumi.Input<inputs.ContainerLegacyClone | undefined>;
/**
* The console configuration.
*/
console?: pulumi.Input<inputs.ContainerLegacyConsole | undefined>;
/**
* The CPU configuration.
*/
cpu?: pulumi.Input<inputs.ContainerLegacyCpu | undefined>;
/**
* The description.
*/
description?: pulumi.Input<string | undefined>;
/**
* Device to pass through to the container (multiple blocks supported).
*/
devicePassthroughs?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyDevicePassthrough>[] | undefined>;
/**
* The root filesystem (rootfs) storage configuration.
* Selects the Proxmox storage pool the container's root volume is created
* on. Backend-agnostic — works with directory, LVM, LVM-thin, ZFS, Ceph
* RBD, NFS, and any other configured Proxmox storage.
*/
disk?: pulumi.Input<inputs.ContainerLegacyDisk | undefined>;
/**
* A map of runtime environment variables for the container init process.
*/
environmentVariables?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* The container feature flags. Changing flags (except nesting) is only allowed for `root@pam` authenticated user.
*/
features?: pulumi.Input<inputs.ContainerLegacyFeatures | undefined>;
/**
* The identifier for a file containing a hook script (needs to be executable, e.g. by using the `proxmox_virtual_environment_file.file_mode` attribute).
*/
hookScriptFileId?: pulumi.Input<string | undefined>;
/**
* UID/GID mapping for unprivileged containers (multiple
* blocks supported). These are written as `lxc.idmap` entries in the container
* configuration file via SSH, since the Proxmox API does not support writing
* `lxc[n]` parameters.
*/
idmaps?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyIdmap>[] | undefined>;
/**
* The initialization configuration.
*/
initialization?: pulumi.Input<inputs.ContainerLegacyInitialization | undefined>;
/**
* The memory configuration.
*/
memory?: pulumi.Input<inputs.ContainerLegacyMemory | undefined>;
/**
* An additional volume mount or host bind mount
* (multiple blocks supported). Use this for data volumes, shared
* directories, or attaching pre-existing PVE volumes.
*/
mountPoints?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyMountPoint>[] | undefined>;
/**
* A network interface (multiple blocks
* supported).
*/
networkInterfaces?: pulumi.Input<pulumi.Input<inputs.ContainerLegacyNetworkInterface>[] | undefined>;
/**
* The name of the node to assign the container to.
*/
nodeName: pulumi.Input<string>;
/**
* The Operating System configuration.
*/
operatingSystem?: pulumi.Input<inputs.ContainerLegacyOperatingSystem | undefined>;
/**
* The identifier for a pool to assign the container to.
*/
poolId?: pulumi.Input<string | undefined>;
/**
* Whether to set the protection flag of the container (defaults to `false`). This will prevent the container itself and its disk for remove/update operations.
*/
protection?: pulumi.Input<boolean | undefined>;
/**
* Automatically start container when the host
* system boots (defaults to `true`).
*/
startOnBoot?: pulumi.Input<boolean | undefined>;
/**
* Whether to start the container (defaults to `true`).
*/
started?: pulumi.Input<boolean | undefined>;
/**
* Defines startup and shutdown behavior of the container.
*/
startup?: pulumi.Input<inputs.ContainerLegacyStartup | undefined>;
/**
* A list of tags the container tags. This is only meta
* information (defaults to `[]`). Note: Proxmox always sorts the container tags and set them to lowercase.
* If tag contains capital letters, then Proxmox will always report a
* difference on the resource. You may use the `ignoreChanges` lifecycle
* meta-argument to ignore changes to this attribute.
*/
tags?: pulumi.Input<pulumi.Input<string>[] | undefined>;
/**
* Whether to create a template (defaults to `false`).
*/
template?: pulumi.Input<boolean | undefined>;
/**
* Timeout for cloning a container in seconds (defaults to 1800).
*/
timeoutClone?: pulumi.Input<number | undefined>;
/**
* Timeout for creating a container in seconds (defaults to 1800).
*/
timeoutCreate?: pulumi.Input<number | undefined>;
/**
* Timeout for deleting a container in seconds (defaults to 60).
*/
timeoutDelete?: pulumi.Input<number | undefined>;
/**
* Start container timeout
*
* @deprecated This field is deprecated and will be removed in a future release. An overall operation timeout (`timeoutCreate` / `timeoutClone`) is used instead.
*/
timeoutStart?: pulumi.Input<number | undefined>;
/**
* Timeout for updating a container in seconds (defaults to 1800).
*/
timeoutUpdate?: pulumi.Input<number | undefined>;
/**
* Whether the container runs as unprivileged on the host (defaults to `false`).
*/
unprivileged?: pulumi.Input<boolean | undefined>;
/**
* The container identifier
*/
vmId?: pulumi.Input<number | undefined>;
/**
* Configuration for waiting for specific IP address types when the container starts.
*/
waitForIp?: pulumi.Input<inputs.ContainerLegacyWaitForIp | undefined>;
}
//# sourceMappingURL=containerLegacy.d.ts.map