@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
321 lines • 11.1 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.VmLegacy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* > **Deprecated:** Use `proxmoxve.cloned.Vm` instead. This resource will be removed in v1.0.
*
* > **EXPERIMENTAL**
*
* Clone a VM from a source template/VM and manage only explicitly-defined configuration. This resource uses explicit opt-in management: only configuration blocks and devices explicitly listed in your Terraform code are managed. Inherited settings from the template are preserved unless explicitly overridden or deleted. Removing a configuration from Terraform stops managing it but does not delete it from the VM.
*
* ## Limitations
*
* This resource intentionally manages only a subset of VM configuration. The following are currently not managed and must be inherited from the source template (or managed via `proxmoxve.VmLegacy` with a `clone` block):
*
* - BIOS / machine / boot order
* - EFI disk / secure boot settings
* - TPM state
* - Cloud-init / initialization
* - QEMU guest agent configuration
* - PCI/USB passthrough, serial/audio devices, watchdog, VirtioFS
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* // Example 1: Basic clone with minimal management
* const basicClone = new proxmoxve.cloned.VmLegacy("basic_clone", {
* nodeName: "pve",
* name: "basic-clone",
* clone: {
* sourceVmId: 100,
* full: true,
* },
* cpu: {
* cores: 4,
* },
* });
* // Example 2: Clone with explicit network management
* const networkManaged = new proxmoxve.cloned.VmLegacy("network_managed", {
* nodeName: "pve",
* name: "network-clone",
* clone: {
* sourceVmId: 100,
* },
* network: {
* net0: {
* bridge: "vmbr0",
* model: "virtio",
* tag: 100,
* },
* net1: {
* bridge: "vmbr1",
* model: "virtio",
* firewall: true,
* macAddress: "BC:24:11:2E:C5:00",
* },
* },
* cpu: {
* cores: 2,
* },
* });
* // Example 3: Clone with disk management
* const diskManaged = new proxmoxve.cloned.VmLegacy("disk_managed", {
* nodeName: "pve",
* name: "disk-clone",
* clone: {
* sourceVmId: 100,
* targetDatastore: "local-lvm",
* },
* disk: {
* scsi0: {
* datastoreId: "local-lvm",
* sizeGb: 50,
* discard: "on",
* ssd: true,
* },
* scsi1: {
* datastoreId: "local-lvm",
* sizeGb: 100,
* backup: false,
* },
* },
* });
* // Example 4: Clone with explicit device deletion
* const selectiveDelete = new proxmoxve.cloned.VmLegacy("selective_delete", {
* nodeName: "pve",
* name: "minimal-clone",
* clone: {
* sourceVmId: 100,
* },
* network: {
* net0: {
* bridge: "vmbr0",
* model: "virtio",
* },
* },
* "delete": {
* networks: [
* "net1",
* "net2",
* ],
* },
* });
* // Example 5: Full-featured clone with multiple settings
* const fullFeatured = new proxmoxve.cloned.VmLegacy("full_featured", {
* nodeName: "pve",
* name: "production-vm",
* description: "Production VM cloned from template",
* tags: [
* "production",
* "web",
* ],
* clone: {
* sourceVmId: 100,
* sourceNodeName: "pve",
* full: true,
* targetDatastore: "local-lvm",
* retries: 3,
* },
* cpu: {
* cores: 8,
* sockets: 1,
* architecture: "x86_64",
* type: "host",
* },
* memory: {
* size: 8192,
* balloon: 2048,
* shares: 2000,
* },
* network: {
* net0: {
* bridge: "vmbr0",
* model: "virtio",
* tag: 100,
* firewall: true,
* rateLimit: 100,
* },
* },
* disk: {
* scsi0: {
* datastoreId: "local-lvm",
* sizeGb: 100,
* discard: "on",
* iothread: true,
* ssd: true,
* cache: "writethrough",
* },
* },
* vga: {
* type: "std",
* memory: 16,
* },
* "delete": {
* disks: ["ide2"],
* },
* stopOnDestroy: false,
* purgeOnDestroy: true,
* deleteUnreferencedDisksOnDestroy: false,
* timeouts: {
* create: "30m",
* update: "30m",
* "delete": "10m",
* },
* });
* // Example 6: Linked clone for testing
* const testClone = new proxmoxve.cloned.VmLegacy("test_clone", {
* nodeName: "pve",
* name: "test-vm",
* clone: {
* sourceVmId: 100,
* full: false,
* },
* cpu: {
* cores: 2,
* },
* network: {
* net0: {
* bridge: "vmbr0",
* model: "virtio",
* },
* },
* });
* // Example 7: Clone with pool assignment
* const pooledClone = new proxmoxve.cloned.VmLegacy("pooled_clone", {
* nodeName: "pve",
* name: "pooled-vm",
* clone: {
* sourceVmId: 100,
* poolId: "production",
* },
* cpu: {
* cores: 4,
* },
* });
* // Example 8: Import existing cloned VM
* const imported = new proxmoxve.cloned.VmLegacy("imported", {
* resourceId: "123",
* nodeName: "pve",
* clone: {
* sourceVmId: 100,
* },
* cpu: {
* cores: 4,
* },
* });
* ```
*/
class VmLegacy extends pulumi.CustomResource {
/**
* Get an existing VmLegacy 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 VmLegacy(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'proxmoxve:cloned/vmLegacy:VmLegacy';
/**
* Returns true if the given object is an instance of VmLegacy. 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'] === VmLegacy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cdrom"] = state?.cdrom;
resourceInputs["clone"] = state?.clone;
resourceInputs["cpu"] = state?.cpu;
resourceInputs["delete"] = state?.delete;
resourceInputs["deleteUnreferencedDisksOnDestroy"] = state?.deleteUnreferencedDisksOnDestroy;
resourceInputs["description"] = state?.description;
resourceInputs["disk"] = state?.disk;
resourceInputs["memory"] = state?.memory;
resourceInputs["name"] = state?.name;
resourceInputs["network"] = state?.network;
resourceInputs["nodeName"] = state?.nodeName;
resourceInputs["purgeOnDestroy"] = state?.purgeOnDestroy;
resourceInputs["resourceId"] = state?.resourceId;
resourceInputs["rng"] = state?.rng;
resourceInputs["started"] = state?.started;
resourceInputs["stopOnDestroy"] = state?.stopOnDestroy;
resourceInputs["tags"] = state?.tags;
resourceInputs["timeouts"] = state?.timeouts;
resourceInputs["vga"] = state?.vga;
}
else {
const args = argsOrState;
if (args?.clone === undefined && !opts.urn) {
throw new Error("Missing required property 'clone'");
}
if (args?.nodeName === undefined && !opts.urn) {
throw new Error("Missing required property 'nodeName'");
}
resourceInputs["cdrom"] = args?.cdrom;
resourceInputs["clone"] = args?.clone;
resourceInputs["cpu"] = args?.cpu;
resourceInputs["delete"] = args?.delete;
resourceInputs["deleteUnreferencedDisksOnDestroy"] = args?.deleteUnreferencedDisksOnDestroy;
resourceInputs["description"] = args?.description;
resourceInputs["disk"] = args?.disk;
resourceInputs["memory"] = args?.memory;
resourceInputs["name"] = args?.name;
resourceInputs["network"] = args?.network;
resourceInputs["nodeName"] = args?.nodeName;
resourceInputs["purgeOnDestroy"] = args?.purgeOnDestroy;
resourceInputs["resourceId"] = args?.resourceId;
resourceInputs["rng"] = args?.rng;
resourceInputs["started"] = args?.started;
resourceInputs["stopOnDestroy"] = args?.stopOnDestroy;
resourceInputs["tags"] = args?.tags;
resourceInputs["timeouts"] = args?.timeouts;
resourceInputs["vga"] = args?.vga;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VmLegacy.__pulumiType, name, resourceInputs, opts);
}
}
exports.VmLegacy = VmLegacy;
//# sourceMappingURL=vmLegacy.js.map