Imports are failing
BongoEADGC6 opened this issue · 12 comments
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
I'm also facing similar issues when trying to import existing configurations from my proxmox cluster.
Is this related to the workaround for the provider-configuration somehow?
I tried running
pulumi import proxmoxve:VM/virtualMachine:VirtualMachine Faraday 200 --provider=urn:pulumi:prod::pulum::pulumi:providers:proxmoxve::proxmoxve
where Faraday
would be the name of my vm and 200
would be its vmId.
The response looks like that:
proxmoxve:VM:VirtualMachine (Faraday):
error: Preview failed: refreshing urn:pulumi:prod::pulum::proxmoxve:VM/virtualMachine:VirtualMachine::Faraday: 1 error occurred:
* received an HTTP 501 response - Reason: Method 'GET /nodes//qemu/200/config' not implemented
Is this even a supported feature?
@muhlba91 Any thoughts about this? Is this currently supported?
as @BongoEADGC6 noted the request to proxmox needs to contain the node.
this provider relies on the terraform upstream provider, and code generation is automated.
hence, this is not implemented and supported currently.
supporting this feature would need be implemented besides the automatically generated code, or the provider been rewritten natively for pulumi by not leveraging an already existing terraform provider.
currently i do not have any plans on supporting this but happy to accept PRs as long as they are working side by side with the autogeneration.
That's disappointing to hear as I noticed that the upstream Terraform module chosen for this provider decided they won't bother to support importing (bpg/terraform-provider-proxmox#29). However, the more popular Terraform module (https://github.com/Telmate/terraform-provider-proxmox) for proxmox supports all functions. Any thoughts on potentially swapping the upstream?
thank you for providing this update on upstream's response.
it's unfortunate to hear about this but i also understand that some features don't have priority - it's the same here. this is a personal project besides others which also take time commitments.
i wanted to take some time to elaborate on the choice i made back then.
-
back when i planned for the provider, i initially planned to use https://github.com/Telmate/terraform-provider-proxmox.
unfortunately, (at least back then) i was not able to get it working for my use case (cloud-init and some VM settings were not easily achievable). (note: this doesn't necessarily have to be true anymore.) -
then i found https://github.com/bpg/terraform-provider-proxmox which had a broader functionality (and still has), and supported my use cases in a very user friendly and easy to maintain manner. it still has some caveats for some particular use cases but those are minor and negligible for me.
-
the last option i was eyeing with was making this provider native, meaning cutting out the terraform upstream and implementing all resources in a native way. the downsides are the work required, not being able to rely on a tested and used upstream provider, ongoing maintenance, and lack of knowledge on my side.
this would also come with a reduced set of functionality - at least initially - geared towards my use cases, and dependent on implementation work necessary for any additional feature. even in that case, importing would not be my priority though.
hence, the choice was made towards https://github.com/bpg/terraform-provider-proxmox.
now, swapping upstream would introduce a major change and break in functionality, and reduce the exposed feature set. currently - and i'm sorry to say this - i don't see this as a viable option.
going forward if upstream doesn't implement this, i see (3) as the only option to have this supported within this provider in the future. i do lack time for this, and it would definitely not be high on my priority list to write a new provider (and support importing straight away). speaking openly though, i'm still eyeing with this idea for future developments.
alternatively, you can always spin off a new provider and plug in the other upstream. (i'm happy to support initially but will not take ownership or commitments, and maintenance towards that.)
Hi there!
Most of the resources (including proxmox_virtual_environment_vm
) now support import functionality. Please check upstream provider's documentation for more details, resources with import support have Import section in their docs.
Does this Pulumi module now include this feature as well after having been updated to use upstream 0.31?
i just had a try with the following import.json
:
{
"nameTable": {
"proxmoxve": "urn:pulumi:dev::pulumi-proxmoxve-test::pulumi:providers:proxmoxve::proxmoxve"
},
"resources": [
{
"type": "proxmoxve:VM/virtualMachine:VirtualMachine",
"name": "vm-test-test.proxmox-dev",
"id": "pve/102",
"provider": "proxmoxve"
}
]
}
importing seemed to work; however, some values/properties couldn't be fetched/appropriately filled and had to be adapted manually after the importing. a refresh
seemed to have updated them though.
* strconv.Atoi: parsing "pve/102": invalid syntax
I'm receiving the above error using the same config as you provided with the urn of proxmox updated. Using Pulumi v3.85.0 and PVE 8.0.4.
What versions are you using?
all relevant versions are the following.
pulumi version: v3.85.0
pve: 8.0.4
@muhlba91/pulumi-proxmoxve: 5.11.1
@BongoEADGC6 take care with my example that my PVE host is named pve
- hence, the "id": "pve/102"
referring to my node and the vm id. if your PVE host is named differently, you also need to adapt that id.
After fixing my node_modules, things seem to be working now! Thanks for all of your help.