@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
230 lines • 14 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.VirtualMachine = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a virtual machine.
*
* ## High Availability
*
* When managing a virtual machine in a multi-node cluster, the VM's HA settings can
* be managed using the `proxmoxve.HA.HAResource` resource.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const ubuntuVmVirtualMachine = new proxmoxve.vm.VirtualMachine("ubuntuVmVirtualMachine", {vmId: 4321});
* const ubuntuVmHAResource = new proxmoxve.ha.HAResource("ubuntuVmHAResource", {
* comment: "Managed by Pulumi",
* group: "node1",
* resourceId: pulumi.interpolate`vm:${ubuntuVmVirtualMachine.vmId}`,
* state: "started",
* });
* ```
*
* ## Important Notes
*
* ### `local-lvm` Datastore
*
* The `local-lvm` is the **default datastore** for many configuration blocks, including `initialization` and `tpmState`, which may not seem to be related to "storage".
* If you do not have `local-lvm` configured in your environment, you may need to explicitly set the `datastoreId` in such blocks to a different value.
*
* ### Cloning
*
* When cloning an existing virtual machine, whether it's a template or not, the
* resource will inherit the disks and other configuration from the source VM.
*
* *If* you modify any attributes of an existing disk in the clone, you also need to\
* explicitly provide values for any other attributes that differ from the schema defaults\
* in the source (e.g., `size`, `discard`, `cache`, `aio`).\
* Otherwise, the schema defaults will take effect and override the source values.
*
* Furthermore, when cloning from one node to a different one, the behavior changes
* depening on the datastores of the source VM. If at least one non-shared
* datastore is used, the VM is first cloned to the source node before being
* migrated to the target node. This circumvents a limitation in the Proxmox clone
* API.
*
* Because the migration step after the clone tries to preserve the used
* datastores by their name, it may fail if a datastore used in the source VM is
* not available on the target node (e.g. `local-lvm` is used on the source node in
* the VM but no `local-lvm` datastore is available on the target node). In this
* case, it is recommended to set the `datastoreId` argument in the `clone` block
* to force the migration step to migrate all disks to a specific datastore on the
* target node. If you need certain disks to be on specific datastores, set
* the `datastoreId` argument of the disks in the `disks` block to move the disks
* to the correct datastore after the cloning and migrating succeeded.
*
* ## Import
*
* Instances can be imported using the `node_name` and the `vm_id`, e.g.,
*
* bash
*
* ```sh
* $ pulumi import proxmoxve:VM/virtualMachine:VirtualMachine ubuntu_vm first-node/4321
* ```
*/
class VirtualMachine extends pulumi.CustomResource {
/**
* Get an existing VirtualMachine 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 VirtualMachine(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of VirtualMachine. 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'] === VirtualMachine.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["acpi"] = state ? state.acpi : undefined;
resourceInputs["agent"] = state ? state.agent : undefined;
resourceInputs["amdSev"] = state ? state.amdSev : undefined;
resourceInputs["audioDevice"] = state ? state.audioDevice : undefined;
resourceInputs["bios"] = state ? state.bios : undefined;
resourceInputs["bootOrders"] = state ? state.bootOrders : undefined;
resourceInputs["cdrom"] = state ? state.cdrom : undefined;
resourceInputs["clone"] = state ? state.clone : undefined;
resourceInputs["cpu"] = state ? state.cpu : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["disks"] = state ? state.disks : undefined;
resourceInputs["efiDisk"] = state ? state.efiDisk : undefined;
resourceInputs["hookScriptFileId"] = state ? state.hookScriptFileId : undefined;
resourceInputs["hostpcis"] = state ? state.hostpcis : undefined;
resourceInputs["initialization"] = state ? state.initialization : undefined;
resourceInputs["ipv4Addresses"] = state ? state.ipv4Addresses : undefined;
resourceInputs["ipv6Addresses"] = state ? state.ipv6Addresses : undefined;
resourceInputs["keyboardLayout"] = state ? state.keyboardLayout : undefined;
resourceInputs["kvmArguments"] = state ? state.kvmArguments : undefined;
resourceInputs["macAddresses"] = state ? state.macAddresses : undefined;
resourceInputs["machine"] = state ? state.machine : undefined;
resourceInputs["memory"] = state ? state.memory : undefined;
resourceInputs["migrate"] = state ? state.migrate : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["networkDevices"] = state ? state.networkDevices : undefined;
resourceInputs["networkInterfaceNames"] = state ? state.networkInterfaceNames : undefined;
resourceInputs["nodeName"] = state ? state.nodeName : undefined;
resourceInputs["numas"] = state ? state.numas : undefined;
resourceInputs["onBoot"] = state ? state.onBoot : undefined;
resourceInputs["operatingSystem"] = state ? state.operatingSystem : undefined;
resourceInputs["poolId"] = state ? state.poolId : undefined;
resourceInputs["protection"] = state ? state.protection : undefined;
resourceInputs["reboot"] = state ? state.reboot : undefined;
resourceInputs["rebootAfterUpdate"] = state ? state.rebootAfterUpdate : undefined;
resourceInputs["rngs"] = state ? state.rngs : undefined;
resourceInputs["scsiHardware"] = state ? state.scsiHardware : undefined;
resourceInputs["serialDevices"] = state ? state.serialDevices : undefined;
resourceInputs["smbios"] = state ? state.smbios : undefined;
resourceInputs["started"] = state ? state.started : undefined;
resourceInputs["startup"] = state ? state.startup : undefined;
resourceInputs["stopOnDestroy"] = state ? state.stopOnDestroy : undefined;
resourceInputs["tabletDevice"] = state ? state.tabletDevice : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["template"] = state ? state.template : undefined;
resourceInputs["timeoutClone"] = state ? state.timeoutClone : undefined;
resourceInputs["timeoutCreate"] = state ? state.timeoutCreate : undefined;
resourceInputs["timeoutMigrate"] = state ? state.timeoutMigrate : undefined;
resourceInputs["timeoutMoveDisk"] = state ? state.timeoutMoveDisk : undefined;
resourceInputs["timeoutReboot"] = state ? state.timeoutReboot : undefined;
resourceInputs["timeoutShutdownVm"] = state ? state.timeoutShutdownVm : undefined;
resourceInputs["timeoutStartVm"] = state ? state.timeoutStartVm : undefined;
resourceInputs["timeoutStopVm"] = state ? state.timeoutStopVm : undefined;
resourceInputs["tpmState"] = state ? state.tpmState : undefined;
resourceInputs["usbs"] = state ? state.usbs : undefined;
resourceInputs["vga"] = state ? state.vga : undefined;
resourceInputs["virtiofs"] = state ? state.virtiofs : undefined;
resourceInputs["vmId"] = state ? state.vmId : undefined;
resourceInputs["watchdog"] = state ? state.watchdog : undefined;
}
else {
const args = argsOrState;
if ((!args || args.nodeName === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeName'");
}
resourceInputs["acpi"] = args ? args.acpi : undefined;
resourceInputs["agent"] = args ? args.agent : undefined;
resourceInputs["amdSev"] = args ? args.amdSev : undefined;
resourceInputs["audioDevice"] = args ? args.audioDevice : undefined;
resourceInputs["bios"] = args ? args.bios : undefined;
resourceInputs["bootOrders"] = args ? args.bootOrders : undefined;
resourceInputs["cdrom"] = args ? args.cdrom : undefined;
resourceInputs["clone"] = args ? args.clone : undefined;
resourceInputs["cpu"] = args ? args.cpu : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["disks"] = args ? args.disks : undefined;
resourceInputs["efiDisk"] = args ? args.efiDisk : undefined;
resourceInputs["hookScriptFileId"] = args ? args.hookScriptFileId : undefined;
resourceInputs["hostpcis"] = args ? args.hostpcis : undefined;
resourceInputs["initialization"] = args ? args.initialization : undefined;
resourceInputs["keyboardLayout"] = args ? args.keyboardLayout : undefined;
resourceInputs["kvmArguments"] = args ? args.kvmArguments : undefined;
resourceInputs["macAddresses"] = args ? args.macAddresses : undefined;
resourceInputs["machine"] = args ? args.machine : undefined;
resourceInputs["memory"] = args ? args.memory : undefined;
resourceInputs["migrate"] = args ? args.migrate : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["networkDevices"] = args ? args.networkDevices : undefined;
resourceInputs["nodeName"] = args ? args.nodeName : undefined;
resourceInputs["numas"] = args ? args.numas : undefined;
resourceInputs["onBoot"] = args ? args.onBoot : undefined;
resourceInputs["operatingSystem"] = args ? args.operatingSystem : undefined;
resourceInputs["poolId"] = args ? args.poolId : undefined;
resourceInputs["protection"] = args ? args.protection : undefined;
resourceInputs["reboot"] = args ? args.reboot : undefined;
resourceInputs["rebootAfterUpdate"] = args ? args.rebootAfterUpdate : undefined;
resourceInputs["rngs"] = args ? args.rngs : undefined;
resourceInputs["scsiHardware"] = args ? args.scsiHardware : undefined;
resourceInputs["serialDevices"] = args ? args.serialDevices : undefined;
resourceInputs["smbios"] = args ? args.smbios : undefined;
resourceInputs["started"] = args ? args.started : undefined;
resourceInputs["startup"] = args ? args.startup : undefined;
resourceInputs["stopOnDestroy"] = args ? args.stopOnDestroy : undefined;
resourceInputs["tabletDevice"] = args ? args.tabletDevice : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["template"] = args ? args.template : undefined;
resourceInputs["timeoutClone"] = args ? args.timeoutClone : undefined;
resourceInputs["timeoutCreate"] = args ? args.timeoutCreate : undefined;
resourceInputs["timeoutMigrate"] = args ? args.timeoutMigrate : undefined;
resourceInputs["timeoutMoveDisk"] = args ? args.timeoutMoveDisk : undefined;
resourceInputs["timeoutReboot"] = args ? args.timeoutReboot : undefined;
resourceInputs["timeoutShutdownVm"] = args ? args.timeoutShutdownVm : undefined;
resourceInputs["timeoutStartVm"] = args ? args.timeoutStartVm : undefined;
resourceInputs["timeoutStopVm"] = args ? args.timeoutStopVm : undefined;
resourceInputs["tpmState"] = args ? args.tpmState : undefined;
resourceInputs["usbs"] = args ? args.usbs : undefined;
resourceInputs["vga"] = args ? args.vga : undefined;
resourceInputs["virtiofs"] = args ? args.virtiofs : undefined;
resourceInputs["vmId"] = args ? args.vmId : undefined;
resourceInputs["watchdog"] = args ? args.watchdog : undefined;
resourceInputs["ipv4Addresses"] = undefined /*out*/;
resourceInputs["ipv6Addresses"] = undefined /*out*/;
resourceInputs["networkInterfaceNames"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VirtualMachine.__pulumiType, name, resourceInputs, opts);
}
}
exports.VirtualMachine = VirtualMachine;
/** @internal */
VirtualMachine.__pulumiType = 'proxmoxve:VM/virtualMachine:VirtualMachine';
//# sourceMappingURL=virtualMachine.js.map