@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
155 lines • 6.38 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.Zfs = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../../utilities"));
/**
* Manages a ZFS pool (zpool) on a Proxmox VE node.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const example = new proxmoxve.node.disk.Zfs("example", {
* nodeName: "pve",
* name: "tank",
* devices: [
* "/dev/sdb",
* "/dev/sdc",
* ],
* raidlevel: "mirror",
* ashift: 12,
* compression: "lz4",
* addStorage: true,
* cleanupConfig: true,
* cleanupDisks: false,
* });
* ```
*
* ## Device Reuse After Destroy
*
* When `cleanupDisks = true`, Proxmox wipes the contents of each ZFS member partition
* (e.g. `/dev/nvme0n1p1`) but leaves the parent disk's GPT partition table intact.
* If you destroy a pool and immediately recreate it on the same device, the create may
* fail with _"device is already in use"_.
*
* To fully prepare the device for reuse after destroy, run on the Proxmox node:
*
* ```sh
* wipefs -a /dev/nvme0n1
* partprobe /dev/nvme0n1
* ```
*
* Replace `/dev/nvme0n1` with the actual disk device (not the partition).
*
* ## Import
*
* !/usr/bin/env sh
* ZFS pools can be imported using the format `node_name/pool_name`, e.g.:
*
* ```sh
* $ pulumi import proxmoxve:node/disk/zfs:Zfs example pve/tank
* ```
*
* > **Note on import:** The write-only attributes `devices`, `raidlevel`, `ashift`, `compression`, `draidConfig`, and `addStorage` cannot be reconstructed from the Proxmox API and must be added to the configuration manually after import. Once added, the next `pulumi up` will record them in state without replacing the pool.
*/
class Zfs extends pulumi.CustomResource {
/**
* Get an existing Zfs 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 Zfs(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'proxmoxve:node/disk/zfs:Zfs';
/**
* Returns true if the given object is an instance of Zfs. 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'] === Zfs.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["addStorage"] = state?.addStorage;
resourceInputs["ashift"] = state?.ashift;
resourceInputs["cleanupConfig"] = state?.cleanupConfig;
resourceInputs["cleanupDisks"] = state?.cleanupDisks;
resourceInputs["compression"] = state?.compression;
resourceInputs["devices"] = state?.devices;
resourceInputs["draidConfig"] = state?.draidConfig;
resourceInputs["errors"] = state?.errors;
resourceInputs["name"] = state?.name;
resourceInputs["nodeName"] = state?.nodeName;
resourceInputs["raidlevel"] = state?.raidlevel;
resourceInputs["state"] = state?.state;
}
else {
const args = argsOrState;
if (args?.devices === undefined && !opts.urn) {
throw new Error("Missing required property 'devices'");
}
if (args?.nodeName === undefined && !opts.urn) {
throw new Error("Missing required property 'nodeName'");
}
if (args?.raidlevel === undefined && !opts.urn) {
throw new Error("Missing required property 'raidlevel'");
}
resourceInputs["addStorage"] = args?.addStorage;
resourceInputs["ashift"] = args?.ashift;
resourceInputs["cleanupConfig"] = args?.cleanupConfig;
resourceInputs["cleanupDisks"] = args?.cleanupDisks;
resourceInputs["compression"] = args?.compression;
resourceInputs["devices"] = args?.devices;
resourceInputs["draidConfig"] = args?.draidConfig;
resourceInputs["name"] = args?.name;
resourceInputs["nodeName"] = args?.nodeName;
resourceInputs["raidlevel"] = args?.raidlevel;
resourceInputs["errors"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Zfs.__pulumiType, name, resourceInputs, opts);
}
}
exports.Zfs = Zfs;
//# sourceMappingURL=zfs.js.map