This is driving me bats - I'm attempting to get a ...
# getting-started
w
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
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
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
Where is your
Provider
type imported from?
w
Its imported from pulumi_proxmoxve
c
Can you share the complete program that you are trying to run?
w
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
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
Thanks for your assistance
c
Did you get past the issue?
w
No - still trying to find a solution
FYI - I did get there eventually
c
What was it?
w
a missing comma
c
huh? Of course it is. Where was that?