proxmoxve logo

Proxmox Virtual Environment (Proxmox VE)

v2.1.0 published on Friday, Dec 2, 2022 by Daniel Muehlbachler-Pietrzykowski

The Proxmox Virtual Environment (Proxmox VE) provider for Pulumi can be used to provision virtual machines and containers using Proxmox VE.

Example

const proxmox = require("@muhlba91/pulumi-proxmoxve")

const virtualMachine = new proxmox.vm.VirtualMachine('vm', {
    nodeName: 'pve1',
    agent: {
        enabled: false, // toggles checking for ip addresses through qemu-guest-agent
        trim: true,
        type: 'virtio',
    },
    bios: 'seabios',
    cpu: {
        cores: 1,
        sockets: 1,
    },
    clone: {
        nodeName: 'pve1',
        vmId: 9000,
        full: true,
    },
    disks: [
        {
            interface: 'scsi0',
            datastoreId: 'local-lvm',
            size: 32,
            fileFormat: 'qcow2',
        },
    ],
    memory: {
        dedicated: 1024,
    },
    name: 'proxmox-vm',
    networkDevices: [
        {
            bridge: 'vmbr0',
            model: 'virtio',
        },
    ],
    onBoot: true,
    operatingSystem: {
        type: 'l26',
    },
    initialization: {
        type: 'nocloud',
        datastoreId: 'local-lvm',
        dns: {
            domain: 'example.com',
            server: '1.1.1.1 1.0.0.1',
        },
        ipConfigs: [
            {
                ipv4: {
                    address: '10.0.0.10/24',
                    gateway: '10.0.0.1',
                },
                ipv6: {
                    address: 'fd91:0812:a17f:6194::10/64',
                    gateway: 'fd91:0812:a17f:6194::1',
                },
            },
        ],
        userAccount: {
            username: 'proxmox',
            password: 'password',
            keys: ['SSH_PUBLIC_KEY'],
        },
    },
})
import * as proxmox from "@muhlba91/pulumi-proxmoxve";

const virtualMachine = new proxmox.vm.VirtualMachine('vm', {
    nodeName: 'pve1',
    agent: {
        enabled: false, // toggles checking for ip addresses through qemu-guest-agent
        trim: true,
        type: 'virtio',
    },
    bios: 'seabios',
    cpu: {
        cores: 1,
        sockets: 1,
    },
    clone: {
        nodeName: 'pve1',
        vmId: 9000,
        full: true,
    },
    disks: [
        {
            interface: 'scsi0',
            datastoreId: 'local-lvm',
            size: 32,
            fileFormat: 'qcow2',
        },
    ],
    memory: {
        dedicated: 1024,
    },
    name: 'proxmox-vm',
    networkDevices: [
        {
            bridge: 'vmbr0',
            model: 'virtio',
        },
    ],
    onBoot: true,
    operatingSystem: {
        type: 'l26',
    },
    initialization: {
        type: 'nocloud',
        datastoreId: 'local-lvm',
        dns: {
            domain: 'example.com',
            server: '1.1.1.1 1.0.0.1',
        },
        ipConfigs: [
            {
                ipv4: {
                    address: '10.0.0.10/24',
                    gateway: '10.0.0.1',
                },
                ipv6: {
                    address: 'fd91:0812:a17f:6194::10/64',
                    gateway: 'fd91:0812:a17f:6194::1',
                },
            },
        ],
        userAccount: {
            username: 'proxmox',
            password: 'password',
            keys: ['SSH_PUBLIC_KEY'],
        },
    },
})
import pulumi_proxmoxve as proxmox

virtual_machine = proxmox.vm.VirtualMachine("vm",
    node_name="pve1",
    agent=VirtualMachineAgentArgs(
        enabled=False, // toggles checking for ip addresses through qemu-guest-agent
        trim=True,
        type="virtio"
    ),
    bios="seabios",
    cpu=VirtualMachineCpuArgs(
        cores=1,
        sockets=1
    ),
    clone=VirtualMachineCloneArgs(
        node_name="pve1",
        vm_id=9000,
        full=True
    ),
    disks=[
        VirtualMachineDiskArgs(
            interface="scsi0",
            datastore_id="local-lvm",
            size=32,
            file_format="qcow2"
        )
    ],
    memory=VirtualMachineMemoryArgs(
        dedicated=1024
    ),
    name="proxmox-vm",
    network_devices=[
        VirtualMachineNetworkDeviceArgs(
            bridge="vmbr0",
            model="virtio"
        )
    ],
    on_boot: True,
    operating_system: VirtualMachineOperatingSystemArgs(
        type: "l26"
    ),
    initialization=VirtualMachineInitializationArgs(
        type="nocloud",
        datastore_id="local-lvm",
        dns=VirtualMachineInitializationDnsArgs(
            domain="example.com",
            server="1.1.1.1 1.0.0.1"
        ),
        ip_configs: [
            VirtualMachineInitializationIpConfigArgs(
                ipv4=VirtualMachineInitializationIpConfigIpv4Args(
                    address="10.0.0.10/24",
                    gateway="10.0.0.1"
                ),
                ipv6=VirtualMachineInitializationIpConfigIpv6Args(
                    address="fd91:0812:a17f:6194::10/64",
                    gateway="fd91:0812:a17f:6194::1"
                )
            )
        ],
        user_account=VirtualMachineInitializationUserAccountArgs(
            username: "proxmox",
            password: "password",
            keys: ["SSH_PUBLIC_KEY"]
        )
    )
)
using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi;
using Pulumi.ProxmoxVE.VM;
using Pulumi.ProxmoxVE.VM.Inputs;

class Program
{
    static Task Main() =>
        Deployment.Run(() => {
            var virtualMachine = new VirtualMachine("vm", new VirtualMachineArgs
            {
                NodeName="pve1",
                Agent=new VirtualMachineAgentArgs{
                    enabled=false, // toggles checking for ip addresses through qemu-guest-agent
                    trim=true,
                    type="virtio"
                },
                Bios="seabios",
                Cpu=new VirtualMachineCpuArgs{
                    Cores=1,
                    Sockets=1
                },
                Clone=new VirtualMachineCloneArgs{
                    NodeName="pve1",
                    VmId=9000,
                    Full=true
                },
                Disks: [
                    new VirtualMachineDiskArgs{
                        Interface="scsi0",
                        DatastoreId="local-lvm",
                        Size=32,
                        FileFormat="qcow2"
                    }
                ],
                Memory: new VirtualMachineMemoryArgs{
                    Dedicated=1024
                },
                Name="proxmox-vm",
                NetworkDevices: [
                    new VirtualMachineNetworkDeviceArgs{
                        Bridge="vmbr0",
                        Model="virtio"
                    }
                ],
                OnBoot=true,
                OperatingSystem=new VirtualMachineOperatingSystemArgs{
                    type="l26"
                },
                Initialization=new VirtualMachineInitializationArgs{
                    Type="nocloud",
                    DatastoreId="local-lvm",
                    Dns: new VirtualMachineInitializationDnsArgs{
                        Domain="example.com",
                        Server="1.1.1.1 1.0.0.1"
                    },
                    IpConfigs: [
                        new VirtualMachineInitializationIpConfigArgs{
                            Ipv4=new VirtualMachineInitializationIpConfigIpv4Args{
                                Address="10.0.0.10/24",
                                Gateway="10.0.0.1"
                            },
                            Ipv6=new VirtualMachineInitializationIpConfigIpv6Args{
                                Address="fd91:0812:a17f:6194::10/64",
                                Gateway="fd91:0812:a17f:6194::1"
                            }
                        }
                    ],
                    UserAccount: new VirtualMachineInitializationUserAccountArgs{
                        Username="proxmox",
                        Password="password",
                        Keys=["SSH_PUBLIC_KEY"]
                    }
                }
            });
        });
}