@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
294 lines • 12.9 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContainerLegacy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* 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
* ```
*/
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, id, state, opts) {
return new ContainerLegacy(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'proxmoxve:index/containerLegacy: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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === ContainerLegacy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["clone"] = state?.clone;
resourceInputs["console"] = state?.console;
resourceInputs["cpu"] = state?.cpu;
resourceInputs["description"] = state?.description;
resourceInputs["devicePassthroughs"] = state?.devicePassthroughs;
resourceInputs["disk"] = state?.disk;
resourceInputs["environmentVariables"] = state?.environmentVariables;
resourceInputs["features"] = state?.features;
resourceInputs["hookScriptFileId"] = state?.hookScriptFileId;
resourceInputs["idmaps"] = state?.idmaps;
resourceInputs["initialization"] = state?.initialization;
resourceInputs["ipv4"] = state?.ipv4;
resourceInputs["ipv6"] = state?.ipv6;
resourceInputs["memory"] = state?.memory;
resourceInputs["mountPoints"] = state?.mountPoints;
resourceInputs["networkInterfaces"] = state?.networkInterfaces;
resourceInputs["nodeName"] = state?.nodeName;
resourceInputs["operatingSystem"] = state?.operatingSystem;
resourceInputs["poolId"] = state?.poolId;
resourceInputs["protection"] = state?.protection;
resourceInputs["startOnBoot"] = state?.startOnBoot;
resourceInputs["started"] = state?.started;
resourceInputs["startup"] = state?.startup;
resourceInputs["tags"] = state?.tags;
resourceInputs["template"] = state?.template;
resourceInputs["timeoutClone"] = state?.timeoutClone;
resourceInputs["timeoutCreate"] = state?.timeoutCreate;
resourceInputs["timeoutDelete"] = state?.timeoutDelete;
resourceInputs["timeoutStart"] = state?.timeoutStart;
resourceInputs["timeoutUpdate"] = state?.timeoutUpdate;
resourceInputs["unprivileged"] = state?.unprivileged;
resourceInputs["vmId"] = state?.vmId;
resourceInputs["waitForIp"] = state?.waitForIp;
}
else {
const args = argsOrState;
if (args?.nodeName === undefined && !opts.urn) {
throw new Error("Missing required property 'nodeName'");
}
resourceInputs["clone"] = args?.clone;
resourceInputs["console"] = args?.console;
resourceInputs["cpu"] = args?.cpu;
resourceInputs["description"] = args?.description;
resourceInputs["devicePassthroughs"] = args?.devicePassthroughs;
resourceInputs["disk"] = args?.disk;
resourceInputs["environmentVariables"] = args?.environmentVariables;
resourceInputs["features"] = args?.features;
resourceInputs["hookScriptFileId"] = args?.hookScriptFileId;
resourceInputs["idmaps"] = args?.idmaps;
resourceInputs["initialization"] = args?.initialization;
resourceInputs["memory"] = args?.memory;
resourceInputs["mountPoints"] = args?.mountPoints;
resourceInputs["networkInterfaces"] = args?.networkInterfaces;
resourceInputs["nodeName"] = args?.nodeName;
resourceInputs["operatingSystem"] = args?.operatingSystem;
resourceInputs["poolId"] = args?.poolId;
resourceInputs["protection"] = args?.protection;
resourceInputs["startOnBoot"] = args?.startOnBoot;
resourceInputs["started"] = args?.started;
resourceInputs["startup"] = args?.startup;
resourceInputs["tags"] = args?.tags;
resourceInputs["template"] = args?.template;
resourceInputs["timeoutClone"] = args?.timeoutClone;
resourceInputs["timeoutCreate"] = args?.timeoutCreate;
resourceInputs["timeoutDelete"] = args?.timeoutDelete;
resourceInputs["timeoutStart"] = args?.timeoutStart;
resourceInputs["timeoutUpdate"] = args?.timeoutUpdate;
resourceInputs["unprivileged"] = args?.unprivileged;
resourceInputs["vmId"] = args?.vmId;
resourceInputs["waitForIp"] = args?.waitForIp;
resourceInputs["ipv4"] = undefined /*out*/;
resourceInputs["ipv6"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ContainerLegacy.__pulumiType, name, resourceInputs, opts);
}
}
exports.ContainerLegacy = ContainerLegacy;
//# sourceMappingURL=containerLegacy.js.map