pulumi-proxmoxve
pulumi-proxmoxve copied to clipboard
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
}
]
}