https://pulumi.com logo
#getting-started
Title
# getting-started
w

wooden-night-90022

08/22/2022, 4:00 AM
This is driving me bats - I'm attempting to get a vm initialised on proxmox using the Proxmox Virtual Environment (Proxmox VE) package from the registry.-i don't know whether its a bug or my coding. (and clearly i don't use slack much) The error I get is: proxmoxveVMVirtualMachine (vm-1): error: You must specify the virtual environment details in the provider configuration But the debug shows this: I0822 133813.919223 1359098 schema.go:347] Terraform input virtual_environment = []interface {}{map[string]interface {}{"__defaults":[]interface {}{"otp"}, "endpoint":"https://server.fqdn", "insecure":"true", "otp":"", "password":"apassword", "username":"userid"}} I0822 133813.919966 1359098 schema.go:347] Terraform input __defaults = []interface {}{} This seems to work: provider_ve = 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'], ), ), and I create the vm with: vm_1 = proxmox.vm.VirtualMachine("vm-1",provider=provider_ve,args=vm1_conf_args) so preview works and then it fails with the error above. At this point I almost hope its a bug - because then having wasted a lot of time - I might console myself that its not me its the package.
c

clever-sunset-76585

08/22/2022, 4:12 AM
I believe you should pass the
provider
input as part of the resource options property.
provider
typically isn't a top-level property as it is a standard property of
ResourceOptions
property bag. So something like:
Copy code
vm_1 = proxmox.vm.VirtualMachine("vm-1",opts=pulumi.ResourceOptions(provider=provider_ve),args=vm1_conf_args)
w

wooden-night-90022

08/22/2022, 4:29 AM
Thanks - I did try that but it throws: vm_1 = proxmox.vm.VirtualMachine("vm-1",opts=pulumi.ResourceOptions(provider=provider_ve),args=vm1_conf_args) File "/home/admin-cs97/pulumi/talos-1/venv/lib/python3.8/site-packages/pulumi_proxmoxve/vm/virtual_machine.py", line 1176, in init self._internal_init(resource_name, opts, **resource_args.dict) File "/home/admin-cs97/pulumi/talos-1/venv/lib/python3.8/site-packages/pulumi_proxmoxve/vm/virtual_machine.py", line 1260, in _internal_init super(VirtualMachine, self).__init__( File "/home/admin-cs97/pulumi/talos-1/venv/lib/python3.8/site-packages/pulumi/resource.py", line 1081, in init Resource.__init__(self, t, name, True, props, opts, False, dependency) File "/home/admin-cs97/pulumi/talos-1/venv/lib/python3.8/site-packages/pulumi/resource.py", line 914, in init if self._provider and self._provider.package != pkg: AttributeError: 'tuple' object has no attribute 'package'
c

clever-sunset-76585

08/22/2022, 5:01 AM
Where is your
Provider
type imported from?
w

wooden-night-90022

08/22/2022, 5:04 AM
Its imported from pulumi_proxmoxve
c

clever-sunset-76585

08/22/2022, 5:29 AM
Can you share the complete program that you are trying to run?
w

wooden-night-90022

08/22/2022, 5:35 AM
Here it is: import os import pulumi import pulumi_proxmoxve as proxmox # from pulumi_proxmoxve import ProviderVirtualEnvironmentArgs # from pulumi_proxmoxve.vm import * 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'], ), ), vm1_conf_args = proxmox.vm.VirtualMachineArgs( node_name="d08793", agent=proxmox.vm.VirtualMachineAgentArgs( enabled=False, trim=True, type="virtio", ), bios="seabios", cpu=proxmox.vm.VirtualMachineCpuArgs( cores=2, sockets=1 ), clone=proxmox.vm.VirtualMachineCloneArgs( node_name="d08793", vm_id=10103, full=True ), disks=[ proxmox.vm.VirtualMachineDiskArgs( interface="scsi0", datastore_id="netapp", size=32, file_format="qcow2" ) ], memory=proxmox.vm.VirtualMachineMemoryArgs( dedicated=8192 ), name="talos-vm-1", network_devices=[ proxmox.vm.VirtualMachineNetworkDeviceArgs( bridge="vmbr0", model="virtio", vlan_id="2968", ) ], on_boot=True, operating_system=proxmox.vm.VirtualMachineOperatingSystemArgs( type="l26" ), ) vm_1 = proxmox.vm.VirtualMachine("vm-1",args=vm1_conf_args,opts=pulumi.ResourceOptions(provider=provider_ve))
c

clever-sunset-76585

08/22/2022, 4:25 PM
Your code looks right to me, so I am not sure what's going on. I can't try to run it because I don't have a Proxmox env that I can test it against. Maybe make sure you have the latest packages and re-initialize your virtual env? There is something odd with the
proxmox.Provider
instance in your code.
w

wooden-night-90022

08/23/2022, 12:19 AM
Thanks for your assistance
c

clever-sunset-76585

08/23/2022, 12:21 AM
Did you get past the issue?
w

wooden-night-90022

08/23/2022, 1:26 AM
No - still trying to find a solution
FYI - I did get there eventually
c

clever-sunset-76585

08/26/2022, 3:36 AM
What was it?
w

wooden-night-90022

09/02/2022, 4:11 AM
a missing comma
c

clever-sunset-76585

09/02/2022, 4:13 AM
huh? Of course it is. Where was that?
6 Views