Giter Site home page Giter Site logo

muhlba91 / pulumi-proxmoxve Goto Github PK

View Code? Open in Web Editor NEW
89.0 3.0 13.0 4.12 MB

A Pulumi provider for creating and managing Proxmox VE resources

License: Apache License 2.0

Makefile 0.16% Go 0.42% C# 16.92% TypeScript 10.32% Python 28.53% Java 43.65%
pulumi proxmox proxmox-ve

pulumi-proxmoxve's Introduction

Proxmox VE Resource Provider

Buy Me A Coffee

The Proxmox VE Resource Provider for Pulumi lets you manage Proxmox VE resources.

The provider is built on https://github.com/bpg/terraform-provider-proxmox.

Installing

This package is available in many languages in the standard packaging formats.

Installing the Plugin

  1. Download the appropriate archive file from the Releases page: wget https://github.com/muhlba91/pulumi-proxmoxve/releases/download/vX.Y.Z/pulumi-resource-proxmoxve-vX.Y.Z-OPERATING_SYSTEM-ARCH.tar.gz
  2. Add the plugin to Pulumi: pulumi plugin install resource proxmoxve X.Y.Z -f ./pulumi-resource-proxmoxve-vX.Y.Z-OPERATING_SYSTEM-ARCH.tar.gz

Node.js (JavaScript/TypeScript)

To use from JavaScript or TypeScript in Node.js, install using either npm:

npm install @muhlba91/pulumi-proxmoxve

or yarn:

yarn add @muhlba91/pulumi-proxmoxve

Python

To use from Python, install using pip:

pip install pulumi-proxmoxve

Go

To use from Go, use go get to grab the latest version of the library:

go get github.com/muhlba91/pulumi-proxmoxve/sdk/go/...

.NET

To use from .NET, install using dotnet add package:

dotnet add package Pulumi.ProxmoxVE

Configuration

Unfortunately, configuration via environment variables is not (yet) working. To configure the provider you must create and pass it through.

Example for Typescript:

import * as proxmox from '@muhlba91/pulumi-proxmoxve';

const provider = new proxmox.Provider('proxmoxve', {
  endpoint: process.env.PROXMOX_VE_ENDPOINT,
  insecure: process.env.PROXMOX_VE_INSECURE,
  username: process.env.PROXMOX_VE_USERNAME,
  password: process.env.PROXMOX_VE_PASSWORD
});

const args = {};
const vm = new proxmox.vm.VirtualMachine(
  'vm',
  args,
  {
    provider: provider,
  },
);

Reference

For detailed reference documentation, please visit the upstream Terraform provider's documentation at: https://registry.terraform.io/providers/bpg/proxmox/latest.

Some input parameters are required as per the Proxmox API Viewer. Please refer to this documentation for more information regarding required parameters for your Proxmox VE version.

Contributors

Thanks goes to these wonderful people (emoji key):

Daniel MΓΌhlbachler-Pietrzykowski
Daniel MΓΌhlbachler-Pietrzykowski

🚧 πŸ’» πŸ“–
Nelson Costa Martins
Nelson Costa Martins

πŸ’‘
Guinevere Saenger
Guinevere Saenger

πŸ“–
Susan Evans
Susan Evans

πŸ“–
zamrih
zamrih

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

pulumi-proxmoxve's People

Contributors

allcontributors[bot] avatar github-actions[bot] avatar guineveresaenger avatar muhlba91 avatar ncmartins avatar renovate[bot] avatar susanev avatar zamrih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pulumi-proxmoxve's Issues

Invalid Go SDK module

Hey, due to the recent major version 6, the sdk Golang submodule is invalid as for #37.
Seems like the automatic process to handle this did not work as expected ☹️

Missing pool id after pool import leads to recreating the pool

After importing an existing pool, the resource is missing the poolId paramaeter.
On the first pulumi up, tries to recreate the imported pool because it detects the difference between the empty pool id and the real one on the Proxmox server.

Aftter the pool import, the following warning can be seen:

image

.Net Sample

Hello,

I try follow documentation, but actually i cannot deploy VM on Proxmox with C#.

I have no error message, can you give a little working sample ?

Kind regards,

Unable to create vm - unable to get status

Hello,

I am trying to use this Pulumi provider to create a VM, based off the example located here: https://pypi.org/project/pulumi-proxmox/

When running pulumi up, it freezes after cloning the VM image, and debug log shows the following error:

Failed to decode HTTP Get response (path: nodes/pve/qemu/121/status/current) - Reason: json: cannot unmarshal number into Go struct field VirtualEnvironmentVMGetStatusResponseData.data.vmid of type string

Manually starting the created VM allows the VM to boot, but the Pulumi command never completes.

error retrieving next VM ID: received an HTTP 401 response - Reason: no such token 'TOKENID' for user 'dev@pve'

I have exported my token in this form:

Bash:
export PROXMOX_VE_APITOKEN='dev@pve!TOKENID=mytokenicreatedusingthegui'

And I get this:

Bash:
error retrieving next VM ID: received an HTTP 401 response - Reason: no such token 'TOKENID' for user 'dev@pve'

I also tried this:

Bash:
export PROXMOX_VE_APITOKEN='dev@pve!mytokenicreatedusingthegui'

And I get this:

Bash:
pulumi:providers:proxmoxve resource 'proxmoxve' has a problem: could not validate provider configuration: invalid value for api_token (Must be a valid API token, e.g. 'USER@REALM!TOKENID=UUID'). Examine values at 'proxmoxve.apiToken'.

dev has all permissions set to yes.

Is this an error in pulumi or Proxmox or both?

I'm not sure where to go from here. Any ideas or help is greatly appreciated.
Thank you.

Add HA group support

The upstream provider supports creating HA groups and HA resources.
It would be good to have this also in the Pulumi provider.

No parity with upstream tf proxmox provider

Thanks for maintaining this project @muhlba91 !

I think we might be out of sync with the upstream provider, e.g.:

https://github.com/bpg/terraform-provider-proxmox/blame/dd9ffe190cd9eaee7ac6a9e2c830eee45b4b69df/proxmox/virtual_environment_container_types.go#L22

No mention of cloning from snapshots here: https://github.com/muhlba91/pulumi-proxmoxve/blob/main/sdk/nodejs/types/input.ts#L27 (I only see a subset of the upstream available options)

What would you suggest? Been trying to wrap my head around how pulumi uses the tf bridge to dynamically create the matching resources, just can't figure out who/what/when the updates are being called(?)

Imports are failing

Upon attempting to import resources into Pulumi, an error is received. It seems that a node name is expected in order to look up information about the VM within the Proxmox API (https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}). However, I don't see a way to give it this setting in order to properly import the resource.

import config:

{
    "nameTable": {
        "proxmoxve": "urn:pulumi:stack-prod::compute::pulumi:providers:proxmoxve::proxmoxve::ae3ef345-1111-2222-3333-aabbccddeeffgg"
    },
    "resources": [
        {
            "type": "proxmoxve:VM/virtualMachine:VirtualMachine",
            "name": "k3s_master0",
            "id": "101",
            "provider": "proxmoxve",
            "properties": [
                "pvenode1"
            ]
        }
    ]
}

Error:

  proxmoxve:VM:VirtualMachine (k3s_master0):
    error: Preview failed: refreshing urn:pulumi:stack-prod::compute::proxmoxve:VM/virtualMachine:VirtualMachine::k3s_master0: 1 error occurred:
        * received an HTTP 501 response - Reason: Method 'GET /nodes//qemu/101/config' not implemented

proxmox.storage.File can't determine the IP address of node... but proxmox.vm.VirtualMachine can?

I'm trying to create a file to use as user-data... however when I try to create it with:

import pulumi_proxmoxve as proxmox

user_data_file = proxmox.storage.File("user_data_file",
                                      opts = pulumi.ResourceOptions(provider=proxmox_provider),
                                      content_type = 'snippets',
                                      datastore_id = 'local-zfs',
                                      node_name= proxmox_node_name,
                                      source_raw = proxmox.storage.FileSourceRawArgs(data=user_data.rendered, file_name="user_data"))

I get:

proxmoxve:Storage:File (user_data_file):
    error: Failed to determine the IP address of node "moneta"

When I try and run the script.

However, the same node_name seems to work fine when I create a vm:

unbound_vm = proxmox.vm.VirtualMachine("unbound_vm",
    node_name=proxmox_node_name,
    vm_id=6000,

    agent=proxmox.vm.VirtualMachineAgentArgs(
        enabled=True,
        type="virtio"
    ),
    bios="seabios",
    cpu=proxmox.vm.VirtualMachineCpuArgs(
        cores=1,
        sockets=1,
        type="host"
    ),
    clone=proxmox.vm.VirtualMachineCloneArgs(
        vm_id=proxmox_template_id,
        full=False
    ),
    vga=proxmox.vm.VirtualMachineVgaArgs(
        type='serial0'
    ),
    disks=[
        proxmox.vm.VirtualMachineDiskArgs(
            interface="sata0",
            datastore_id="local-zfs",
            size=10,
        )
    ],
    memory=proxmox.vm.VirtualMachineMemoryArgs(
        dedicated=4000,
        floating=1000
    ),
    name="unbound",
    network_devices=[
        proxmox.vm.VirtualMachineNetworkDeviceArgs(
            bridge="vmbr0",
            model="virtio"
        )
    ],
    on_boot= True,
    operating_system= proxmox.vm.VirtualMachineOperatingSystemArgs(
        type= "l26"
),
    initialization=proxmox.vm.VirtualMachineInitializationArgs(
        type="nocloud",
        datastore_id="local-zfs",
        dns=proxmox.vm.VirtualMachineInitializationDnsArgs(
            server="1.1.1.1 1.0.0.1"
        ),
        ip_configs= [
            proxmox.vm.VirtualMachineInitializationIpConfigArgs(
                ipv4=proxmox.vm.VirtualMachineInitializationIpConfigIpv4Args(
                    address=ip_addr,
                    gateway=ip_gateway
                )
            )
        ],
        #user_account=proxmox.vm.VirtualMachineInitializationUserAccountArgs(
            #keys= [ssh_key]
        #),
        user_data_file_id=user_data_file.id # I'm still not sure if this is going to work...
    ),
    opts=pulumi.ResourceOptions(provider=proxmox_provider)
)

Any ideas?

Support Start/Shutdown Orders

I couldnt find how to configure Shutdown timeout with python module.
I tried to configure it from the Proxmox UI and then do a pulumi refresh to observe how it looks like from "the other side". But i got error:

* error retrieving VM: failed to decode HTTP GET response (path: nodes/pve-b2/qemu/100/config) - Reason: json: cannot unmarshal string into Go struct field GetResponseData.data.startup of type vms.CustomStartupOrder

In the qemu config file the configured value looks like this:

# grep "startup" /etc/pve/qemu-server/100.conf
startup: down=400

Is that really unsupported yet or am i missing something?

Empty/non set container features forces replacement on import

I am facing an issue where importing an existing container forces remplacement due to the container features not being set or equivalent to an empty value.

$ pulumi preview
Previewing update (dev):
     Type                           Name                    Plan       Info
     pulumi:pulumi:Stack            pulumiproject-dev             
 ~   β”œβ”€ pulumi:providers:proxmoxve  proxmoxve               update     [diff: ~version]
 =   └─ proxmoxve:CT:Container      111                     import     [diff: +features]; 1 warning

Diagnostics:
  proxmoxve:CT:Container (111):
    warning: inputs to import do not match the existing resource; importing this resource will fail

Resources:
    ~ 1 to update
    = 1 to import
    2 changes. 1 unchanged

The output from the upstream terraform provider translates to nil which then fails to translate to an empty string as the ProxmoxVE API is expecting.

I don't think the upstream terraform provider can do much about it.
A terrform provider will have trouble making the distinction between an empty value and a non set one.

The terraform provider bridge do however provide a resource.PropertyMap.HasValue helper that allows checking for an empty value for a given property.
The helper works well when used in TransformOutputs for a given field.

pulumi preview
Previewing update (dev):
     Type                           Name                    Plan       Info
     pulumi:pulumi:Stack            pulumiproject-dev             
 ~   β”œβ”€ pulumi:providers:proxmoxve  proxmoxve               update     [diff: ~version]
 =   └─ proxmoxve:CT:Container      111                     import     

Resources:
    ~ 1 to update
    = 1 to import
    2 changes. 1 unchanged

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yml
  • google-github-actions/release-please-action v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • sigstore/cosign-installer v3.4.0
  • anchore/sbom-action v0.15.10
  • goreleaser/goreleaser-action v5
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/setup-node v4
  • actions/setup-java v4
  • gradle/gradle-build-action v3
  • JS-DevTools/npm-publish v3
  • gradle/gradle-build-action v3
  • actions/checkout v4
.github/workflows/verify.yml
  • actions/checkout v4
  • siderolabs/conform v0.1.0-alpha.27
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • golangci/golangci-lint-action v4
  • actions/checkout v4
  • actions/setup-go v5
  • jaxxstorm/action-install-gh-release v1.11.0
  • pulumi/actions v5
  • actions/setup-dotnet v4
  • actions/setup-python v5
  • actions/setup-node v4
  • actions/setup-java v4
  • gradle/gradle-build-action v3
gomod
examples/go.mod
  • go 1.20
provider/go.mod
  • go 1.22
  • github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20240229143312-4f60ee4e2975@4f60ee4e2975
  • github.com/bpg/terraform-provider-proxmox v0.50.0
  • github.com/ettle/strcase v0.2.0
  • github.com/pulumi/pulumi-terraform-bridge/pf v0.31.0
  • github.com/pulumi/pulumi-terraform-bridge/v3 v3.78.0
  • github.com/pulumi/pulumi/sdk/v3 v3.111.1
sdk/go.mod
  • go 1.21
  • github.com/blang/semver v3.5.1+incompatible
  • github.com/pulumi/pulumi/sdk/v3 v3.111.1
npm
package.json
  • all-contributors-cli ^6.24.0

  • Check this box to trigger a request for Renovate to run again on this repository

Resizing disk on a clone endless loop

On subsequent pulumi up's, details shows:

  [provider=urn:pulumi:omega::cloud::pulumi:providers:proxmoxve::proxmoxve::7624107a-857f-46a6-a906-452dd1fea95d]
    ~ disk: {
        ~ size: 32 => 100
      }

What seems to happen is the CT gets created based on the clone (32GiB disk), but I want the drive to be bigger; and that only gets picked up after* the clone happens, on subsequent pulumi ups

I don't see a Proxmox UI option to "clone and resize" in one go, so I'm wondering if I could configure the provider differently(?)

The funny part is that it recreates the container when it replaces the disk, and the recreated CT has 32GiB disk size(!); and so on...

The template is itself a stopped container: https://gitlab.com/home.cloud/infra/template/-/blob/main/index.ts?ref_type=heads#L42-45 in an upstream stack that I import to reuse here: https://gitlab.com/home.cloud/infra/cloud/-/blob/main/index.ts?ref_type=heads#L93-110

One option would be to create differently sized templates, but that would defeat the original purpose πŸ˜„

Are changes to disk.size forced by the upstream tf-provider?

Appreciate any hints, thanks!

Error on create ct

Hello!
i have a problem on creating a lxc container, in facts, the lxc created in pve. But alway show the next error in the ends:
imagen

Thank you very much!

darwin-arm64 Provider Build: EOF

When downloading and installing the provider attached to the release (darwin-arm64), running pulumi up throws:

error: could not read plugin [/<PATH_TO>/pulumi-resource-proxmoxve] stdout: EOF

Locally building and using the provider (on a MacBook M1) works.

Tested successfully on:

  • linux/amd64
  • linux/arm64
  • windows/amd64
  • darwin/amd64
  • darwin/arm64

initialise provider with python

Not sure if this is a bug or my coding:
I get this:
Diagnostics:
proxmoxve:VM:VirtualMachine (vm-1):
error: You must specify the virtual environment details in the provider configuration

After exporting the variables in the shell, this what I have for the provider:
import os
import pulumi
import pulumi_proxmoxve as proxmox

provider_ve = proxmox.Provider('proxmoxve',
virtual_environment=proxmox.ProviderVirtualEnvironmentArgs(
endpoint=os.environ['PROXMOX_VE_ENDPOINT'],
insecure=os.environ['PROXMOX_VE_INSECURE'],
username=os.environ['PROXMOX_VE_USERNAME'],
password=os.environ['PROXMOX_VE_PASSWORD']
),
),

I have vm config args and attempt to deploy with:
vm_1 = proxmox.vm.VirtualMachine("vm-1", args=vm1_conf_args,provider=provider_ve)

On update, run into a hostpci error and cloud-init image cannot be replaced.

After updating to 2.3.0 (from 2.0.0), I'm getting:

pulumi:pulumi:Stack (vpn-vpn-infra):
    QH5RPe2C2+yuHOLKkDfgButgt1fuF9wYZieuhAj4pyc=

    error: update failed

  proxmoxve:VM:VirtualMachine (vpn):
    error: 1 error occurred:
    	* creating urn:pulumi:vpn-infra::vpn::proxmoxve:VM/virtualMachine:VirtualMachine::vpn: 1 error occurred:
    	* received an HTTP 400 response - Reason: Parameter verification failed. (hostpci0: invalid format - missing key in comma-separated list property)

Not sure if there is a fix or not.

edit:

There appears to be a problem with replacing the cloud-init image as well.

Change to cpu or memory adds fields to disk, causing recreation of the enter vm

Consider the attached code to create a VM, changing values like cpu or memory causes pulumi to generate the following update plan:

$ pulumi up
Previewing update (dev)

     Type                            Name     Plan       Info
     pulumi:pulumi:Stack             dks-dev
 ~   └─ proxmoxve:VM:VirtualMachine  test     update     [diff: +cdrom~disks,memory]

Resources:
    ~ 1 to update
    2 unchanged

Do you want to perform this update? details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::dks::pulumi:pulumi:Stack::dks-dev]
    ~ proxmoxve:VM/virtualMachine:VirtualMachine: (update)
        [id=100]
        [urn=urn:pulumi:dev::dks::proxmoxve:VM/virtualMachine:VirtualMachine::test]
        [provider=urn:pulumi:dev::dks::pulumi:providers:proxmoxve::proxmoxve::beeb8915-a38f-4e0c-b557-5de5434d438f]
      + cdrom : {
          + enabled: false
          + fileId : ""
        }
      ~ disks : [
          ~ [0]: {
                  + speed: {
                      + read          : 0
                      + readBurstable : 0
                      + write         : 0
                      + writeBurstable: 0
                    }
                }
        ]
      ~ memory: {
          ~ dedicated: 2048 => 1024
        }

I actually changed the memory field, which is correctly represented in the update plan as a change from 2048 => 2014, however the additions to cdrom and the disks[0].speed shouldn't be there. While the addition of cdrom is only annoying when reviewing the update plan, the addition of the disk speed causes serious issues because changes to disks causes recreation of the VM, which means essientially every change causes a recreation, as you can see I tried manually adding the fields that get automatically added (the commented code) but that still causes a recreation. I was wondering if someone can reproduce this issue, if not I might have to check my template creation process.

new proxmox.vm.VirtualMachine('test', {
    name: 'test',
    nodeName: 'srv1',
    agent: {enabled: true},
    bios: 'seabios',
    cpu: {cores: 4},
    tags: ['test'],
    clone: {
        nodeName: 'srv1',
        vmId: 9000,
        full: false,
    },
    // cdrom: {enabled:false,fileId:''},
    disks: [
        {
            interface: 'scsi0',
            datastoreId: 'local-lvm',
            size: 20,
            // speed: {
            //     read:0,readBurstable:0,write:0,writeBurstable:0
            // }
        },
    ],
    memory: {
        dedicated: 1024,
    },
    networkDevices: [
        {
            bridge: 'vmbr0',
            model: 'virtio',
        },
    ],
    onBoot: true,
    operatingSystem: {
        type: 'l26',
    },
    initialization: {
        type: 'nocloud',
        datastoreId: 'local-lvm',
        dns: {
            server: "10.0.0.1",
        },
        ipConfigs: [
            {
                ipv4: {
                    address: `10.0.22.22/16`,
                    gateway: '10.0.0.1',
                },
            },
        ],
        userAccount: {
            username: 'ubuntu',
            keys: [sshkey],
        },
    },
}, {provider: provider})

How to disable replacing CTs on `pulumi up`?

Can't figure out the pulumi, or tf-provider, option to not replace the CTs on every pulumi up

Is this allowed, possible?

Not sure I understand the rationale to always recreate the containers on pulumi up, the behaviour for VMs is exactly the opposite, IMO the expected behaviour (ie: update/patch, not replace).

Add /v3 to Go module

The Go module under sdk has a malformed name. It currently is defined as github.com/muhlba91/pulumi-proxmoxve/sdk, but its import fails has it needs to be followed by /v3. See error at sum.golang.org.

To provide a solve I suggest you add the /v3 to Go module as I did in a fork, and create a new release with tag sdk/vX.Y.Z (see #9). May I suggest v3.1.1 ?

Of course, don't replace your name with mine as I did, it was just to troubleshoot more efficiently πŸ˜‰
Thanks for your work !

Lack of python documentation

unless I'm missing something, I cannot find any examples of how to get this provider working in python.

import pulumi
import os
import pulumi_proxmoxve as proxmox

print("endpoint:", os.getenv("PROXMOX_VE_ENDPOINT"))

provider = proxmox.Provider(resource_name="proxmox_provider",
                            username=os.getenv("PROXMOX_VE_USERNAME"),
                            password=os.getenv("POSTGRES_PASSWORD"),
                            endpoint=os.getenv("PROXMOX_VE_ENDPOINT"),
                            insecure=True)
provider.id.apply(lambda i: print(f"{i}"))

This simple code only results in this as the output

endpoint: https://172.16.10.2:8006

Configuration via Environment Variables

The Terraform provider expects nested configuration or environment variables.
However, setting environment variables does not work and we get a configuration error from the Terraform provider (https://github.com/bpg/terraform-provider-proxmox/blob/main/proxmoxtf/provider.go#L210).

Hence, we need to work-around like this:

const provider = new proxmox.Provider('proxmoxve', {
  virtualEnvironment: {
    endpoint: process.env.PROXMOX_VE_ENDPOINT,
    insecure: process.env.PROXMOX_VE_INSECURE,
    username: process.env.PROXMOX_VE_USERNAME,
    password: process.env.PROXMOX_VE_PASSWORD
  }
});

It would be great if we can pass through environment variables configuration to the provider.

How to use `user_data_file_id` in `VirtualMachineInitialization`?

In the original terraform project, this took an id from a virtual_environment_file object: (https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_file).

But this just takes a string (and I can't figure out if it is used anywhere, as it isn't used in the code in this repo).

I can generate a user-data cloud-config mime multi part archive using the cloud-init package (https://www.pulumi.com/registry/packages/cloudinit/) which is then added as an ISO, but I also need a way to pass network information. This package seems to allow the passing of the network information, but only a simple subset of user-data info. using both the cloud-init package and the initialization parameter of the virtualmachine resource tries to create and attach two cloud-init iso images.

Any ideas how to attach the user-data that I generate using the cloud-init package to the network data generated by the virtual machine resource? (Also, what is the mechanism that allows the cloud-init package to create a cloud-init iso for proxmox transparently?)

Pulumi package publishing error

Hello @muhlba91

I am one of the maintainers of the Pulumi registry. There are some issues getting the latest version of your package (v5.0.0) published to our registry as it seems it is unable to locate a schema file. It looks like in your previous version there was one located there. This seems to no longer be the case with 5.0.0 and our publishing pipeline is giving an error since it is unable to locate a schema file. Not sure if there were some recent changes in the latest release that need to be adjusted here. Feel free to reach out and happy to assist in any way that I can!

Error using initialization fields

When attempting to create a Cloud Template VM using this provider, I am presented with this error:

  proxmoxve:VM:VirtualMachine (Debian Cloud Template Template Virtual Machine):
    error: 1 error occurred:
        * creating urn:pulumi:infra::homelab-infrastructure::HomeLab:Proxmox:CloudImageTemplate$proxmoxve:VM/virtualMachine:VirtualMachine::Debian Cloud Template Template Virtual Machine: 1 error occurred:
        * Image resized.
    unable to parse volume filename '10000000/vm-10000000-disk-0.qcow2.qcow2'

I've put the relevant code here:
https://gist.github.com/0c370t/1fbaecbbbb32d18d7a9207e07c8b1e5b

Related:
bpg/terraform-provider-proxmox#203

timeouts does not apply all the time

The default 1800 sec timeout insanely long for the most part, so I added lower values like this:

...
		TimeoutClone:      pulumi.Int(180),
		TimeoutCreate:     pulumi.Int(180),
		TimeoutMigrate:    pulumi.Int(180),
		TimeoutMoveDisk:   pulumi.Int(180),
		TimeoutReboot:     pulumi.Int(240),
		TimeoutShutdownVm: pulumi.Int(180),
		TimeoutStartVm:    pulumi.Int(180),
		TimeoutStopVm:     pulumi.Int(180),
	}
...

to simulate a possible issue I just stopped the qemu-agent on of our our vm-s, so the API cannot issue a reboot command.

At first run, the 240sec TimeoutReboot applies nicely, 4 min and some change and we have a proper timeout with error massage:

    error: update failed

  proxmoxve:VM:VirtualMachine (103):
    error: 1 error occurred:
        * updating urn:pulumi:nkcloud::proxmox-vm::proxmoxve:VM/virtualMachine:VirtualMachine::103: 1 error occurred:
        * error waiting for VM reboot: task "UPID:test-devops-proxmox01:0023DCB8:030A542D:65E5BDD9:qmreboot:103:root@pam:" failed to complete with exit code:                                                   VM quit/powerdown failed

Outputs:
  - vmname: "pooltest-vm"

Resources:
    4 unchanged

Duration: 4m7s

If I immediately rerun the same code not fixing he "issue" first, the 240sec does not apply anymore:

    error: update failed

Outputs:
  - vmname: "pooltest-vm"

Resources:
    4 unchanged

Duration: 9m30s

error: update cancelled

9:30 when I finally hit ctrl-c

I'm not sure if its Pulumi, Terraform or Proxmox API level issue, but lets start here.

ps.:
I tried https://www.pulumi.com/docs/concepts/options/customtimeouts/
but its just simply does not work, no matter if I apply the provider level values or not.

...
	if vmMachine, err = vm.NewVirtualMachine(
		ctx,
		vmId,
		machineArgs,
		opts,
		pulumi.DeleteBeforeReplace(true),
		pulumi.IgnoreChanges(ignoreString),
		pulumi.Timeouts(&pulumi.CustomTimeouts{
			Create: "4m",
			Update: "4m",
			Delete: "4m"}),
	); err == nil
...

Startup/Shutdown options require the up_delay and down_delay to be set up

In the provider all three parameters for the startup/shutdown are optional. You can see it in its code here

But when i configure in pulumi only the order option, the up_delay and down_delay required to be set up:

proxmox.vm.VirtualMachine(
        startup=proxmox.vm.VirtualMachineStartupArgs(order=1),
  ...

And when running pulumi up:

error: proxmoxve:VM/virtualMachine:VirtualMachine resource 'pve-b8-k8s-worker' has a problem: expected up_delay to be at least (0), got -1. Examine values at 'pve-b8-k8s-worker.startup.upDelay'.
error: proxmoxve:VM/virtualMachine:VirtualMachine resource 'pve-b8-k8s-worker' has a problem: expected down_delay to be at least (0), got -1. Examine values at 'pve-b8-k8s-worker.startup.downDelay'.

Also i need to configure ALL of the VirtualMachineStartupArgs parameters for the Shutdown/Startup options be actually applyed. I.e.

        startup=proxmox.vm.VirtualMachineStartupArgs(order=1, down_delay=1, up_delay=1)

Expected behaviour

Any proxmox.vm.VirtualMachineStartupArgs should be optional.

Python SDK: "grpc: received message larger than max"

When attempting to add source_raw to the proxmox_virtual_environment_file resource, I am receiving the following error:

Exception: grpc: received message larger than max (<size> vs. 419430400)

Stack Trace:

<parent>/venv/Lib/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
        raise _InactiveRpcError(state)
    grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.RESOURCE_EXHAUSTED
        details = "grpc: received message larger than max (<size>vs. 419430400)"
        debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:56826 {grpc_message:"grpc: received message larger than max (<size> vs. 419430400)", grpc_status:8, created_time:"2023-05-28T19:21:14.603349452+00:00"}"

<size> is close to 550000000.

As it exceeds the gRPC maximum, I am wondering if there is a multi-part upload to chunk the large file into separate parts.

Disable default values?

I'm not sure if this is the right place to ask, or is it even possible, but:
Would there be a way NOT to take the default values provided by the Terraform provider?

We are using this Pulumi provider with Go, and redefine some of the defaults to fit our environment, but not all, an those interfere with our code eventually.

For example:
Lets have a VM template we want to clone. The template already has some disks. If I do not define the disks, the default size would apply (8G) which is lower then what's already in the template, thus Proxmox fails that it cannot shrink a disk.
This can be done with the GUI: one can just clone a template VM with only providing a name for the new VM.

How to use a token for Proxmox provider? (alternatively: this might need to be regenerated from tf source)

I'm trying to use a token to connect to my Proxmox instance, unfortunately, I'm getting the following:

❯ pulumi up
Previewing update (infra):
     Type                            Name               Plan     Info
     pulumi:pulumi:Stack             unbound_dns-infra
     └─ proxmoxve:VM:VirtualMachine  unbound_vm                  1 error

Diagnostics:
  proxmoxve:VM:VirtualMachine (unbound_vm):
    error: could not validate provider configuration: 1 error occurred:
    	* You must specify a password for the Proxmox Virtual Environment API

I tried to look at the source terraform Proxmox repo, however the linked one (https://github.com/bpg/terraform-provider-proxmoxve/issues) 404s. A similar one (at least in name) with the same name is here: https://github.com/Telmate/terraform-provider-proxmox, which has been updated fairly recently.

As an aside, I couldn't figure out how the password was required (where in the code that is enforced) as all the options to the provider are listed as optional.

Fail to get sync with Proxmox using python

Updating (python-proxmox):
     Type                           Name                       Status                          Info
 +   pulumi:pulumi:Stack            k8s-python-python-proxmox  **creating failed (0.01s)**     1 error
 +   β”œβ”€ pulumi:providers:proxmoxve  proxmox-provider           created (0.00s)                 
 +   └─ proxmoxve:CT:Container      xxx                **creating failed**             1 error


Diagnostics:
  proxmoxve:CT:Container (xxx):
    error: 1 error occurred:
        * creating urn:pulumi:python-proxmox::k8s-python::proxmoxve:CT/container:Container::xxx: 1 error occurred:
        * timeout while waiting for container "200" to become unlocked

tested both vm and lxc, I got the same error
but after that I can see there is a created lxc in my proxmox, and I can manually kick it start

then when I want to use pulumi refresh to sync the state:

Previewing refresh (python-proxmox):
     Type                           Name                       Plan        Info
     pulumi:pulumi:Stack            k8s-python-python-proxmox              1 error
     β”œβ”€ pulumi:providers:proxmoxve  proxmox-provider                       
 ~   └─ proxmoxve:CT:Container      xxx               refresh     1 error


Diagnostics:
  pulumi:pulumi:Stack (k8s-python-python-proxmox):
    error: preview failed

  proxmoxve:CT:Container (xxx):
    error: Preview failed: refreshing urn:pulumi:python-proxmox::k8s-python::proxmoxve:CT/container:Container::xxx 1 error occurred:
        * failed to decode HTTP GET response (path: nodes/yyy/lxc/200/status/current) - Reason: json: cannot unmarshal string into Go struct field VirtualEnvironmentContainerGetStatusResponseData.data.vmid of type int

it prompts another error

C# SDK CloudInit not take care or configuration on deploy

Hello,

I've test your SDK and it's globally work well, but i've an issue, or incomprehension in my side for deploy a VM templated with Cloud Init.

The code i used to configure VM :

var program = PulumiFn.Create(() =>
{
    var provider = new Pulumi.ProxmoxVE.Provider("proxmoxve", new Pulumi.ProxmoxVE.ProviderArgs()
    {
        Endpoint = "https://192.168.50.200:8006/api2/json",
        Insecure = true,
        Username = "root@pam",
        Password = "password"
    });


    var vm = new Pulumi.ProxmoxVE.VM.VirtualMachine("K3sMaster-01", new Pulumi.ProxmoxVE.VM.VirtualMachineArgs()
    {
        VmId = 700,
        NodeName = "master",
        Name = "K3sMaster-01",
        Initialization = new VirtualMachineInitializationArgs()
        {
            Type = "configdrive2",
            UserAccount = new VirtualMachineInitializationUserAccountArgs()
            {
                Password = "password",
                Username = "username"
            },
            Interface = "ide2",
            Dns = new VirtualMachineInitializationDnsArgs()
            {
                Domain = "K3sMaster-01",
                Server = "192.168.50.1"
            },
            IpConfigs = new InputList<VirtualMachineInitializationIpConfigArgs>()
            {
                new VirtualMachineInitializationIpConfigArgs()
                {
                    Ipv4 = new VirtualMachineInitializationIpConfigIpv4Args()
                    {
                        Address = "dhcp"
                    }
                }
            }
        },
        Clone = new VirtualMachineCloneArgs()
        {
            VmId = 500,
            NodeName = "master",
            Full = true
        },
        Memory = new VirtualMachineMemoryArgs()
        {
            Dedicated = 2048
        },
        Agent = new VirtualMachineAgentArgs()
        {
            Enabled = true
        },
        Cpu = new VirtualMachineCpuArgs()
        {
            Architecture = "x86_64",
            Cores = 2,
            Sockets = 2
        },
        Disks = new InputList<VirtualMachineDiskArgs>()
        {
            new VirtualMachineDiskArgs()
            {
                Interface = "scsi0",
                Size = 32,
                FileFormat = "raw"
            }
        },
    }, new CustomResourceOptions()
    {
        Provider = provider
    });

    return new Dictionary<string, object?>
    {
        ["vmId"] = vm.VmId
    };
});

The deployment :

var projectName = "k3s-dev";
var stackName = "dev-01";
var stackArgs = new InlineProgramArgs(projectName, stackName, program);
var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
await stack.UpAsync();

It's deploy, but the params in Initialization was ignore, and idea ? I've forget something ?

Kr,

Get config of existing vm

Hi, Im new to this so my assumptions might be wrong, but I got 2 vms, and want to create the third vm with pulumi.
Im hoping its possible to look-up an existing vm, modify that config to create the code to generate the third.

https://www.pulumi.com/registry/packages/proxmoxve/api-docs/vm/virtualmachine/#look-up

I have attached my code and the error message I get, seems to complain I dont pass node_name, which I have set to proxmox, unless there is a config somewhere Im missing.

pulumi-proxmoxve==5.13.1

import pulumi
import pulumi_proxmoxve as proxmoxve

ubuntu_vms = proxmoxve.vm.get_virtual_machines()
vm = proxmoxve.vm.get_virtual_machine(node_name="proxmox", vm_id=100)
pulumi.export("vms", ubuntu_vms)
pulumi.export("vm", vm)

nixos=proxmoxve.vm.VirtualMachine.get(resource_name="nixos1", id=100, node_name="proxmox")
pulumi.export("nixos", nixos)
[pulumi:~/repo/pulumi]$ pulumi up
Previewing update (prod)

View in Browser (Ctrl+O): https://app.pulumi.com/henning/proxmox/prod/previews/f5ac0b9c-6044-4f69-9350-f5a1c84ad655

     Type                 Name          Plan     Info
     pulumi:pulumi:Stack  proxmox-prod           1 error


Diagnostics:
  pulumi:pulumi:Stack (proxmox-prod):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/phan/repo/pulumi/./__main__.py", line 11, in <module>
        nixos=proxmoxve.vm.VirtualMachine.get(resource_name="nixos1", id=100, node_name="proxmox")
      File "/Users/phan/repo/pulumi/.venv/lib/python3.9/site-packages/pulumi_proxmoxve/vm/virtual_machine.py", line 2366, in get
        return VirtualMachine(resource_name, opts=opts, __props__=__props__)
      File "/Users/phan/repo/pulumi/.venv/lib/python3.9/site-packages/pulumi_proxmoxve/vm/virtual_machine.py", line 2016, in __init__
        VirtualMachineArgs._configure(_setter, **kwargs)
    TypeError: _configure() missing 1 required positional argument: 'node_name'

Outputs:
  + vm : {
      + id       : "100"
      + name     : "nixos1"
      + node_name: "proxmox"
      + tags     : []
      + vm_id    : 100
    }
  + vms: {
      + id       : "e3d65838-d207-419d-9396-0816753adf7c"
      + node_name: <null>
      + tags     : <null>
      + vms      : [
      +     [0]: {
              + name     : "nixos1"
              + node_name: "proxmox"
              + tags     : []
              + vm_id    : 100
            }
      +     [1]: {
              + name     : "nixos-practice"
              + node_name: "proxmox"
              + tags     : []
              + vm_id    : 101
            }
        ]
    }

`npm install` fails: cannot find module '.../scripts/install-pulumi-plugin.js'

Trying to run npm install @muhlba91/pulumi-proxmoxve fails with this error:

npm ERR! code 1
npm ERR! path /Users/mario-campos/foo/node_modules/@muhlba91/pulumi-proxmoxve
npm ERR! command failed
npm ERR! command sh -c -- node scripts/install-pulumi-plugin.js resource proxmoxve v2.0.0
npm ERR! node:internal/modules/cjs/loader:998
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module '/Users/mario-campos/foo/node_modules/@muhlba91/pulumi-proxmoxve/scripts/install-pulumi-plugin.js'
npm ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:841:27)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
npm ERR!     at node:internal/main/run_main_module:23:47 {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: []
npm ERR! }
npm ERR! 
npm ERR! Node.js v19.0.1

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mario-campos/.npm/_logs/2022-11-12T17_50_13_309Z-debug-0.log

I was able to continue the installation by passing the --ignore-scripts flag:

npm install --ignore-scripts @muhlba91/pulumi-proxmoxve

But this error should ideally not be happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.