Open fatspiderlinux opened 1 year ago
The above error exists for vsphere version 7.0.3, I just tried to import from older vsphere 6.0.0 and got the same issue:
ts=2023-03-24T18:15:59.200093938Z caller=import.go:105 func=provider.Import resource=vsphere_virtual_machine id=/Europe/vm/Templates/template-x-dbmxx_1 total=173 current=111 msg="reading from TF"
Error: could not import from vsphere: could not import resource vsphere_virtual_machine with id /Europe/vm/Templates/template-slvr-dbmxx_1: VM "/Europe/vm/Templates/template-x-dbmxx_1" is a template and cannot be imported
Looks like this error comes from vsphere provider itself: https://github.com/hashicorp/terraform-provider-vsphere/blob/main/vsphere/resource_vsphere_virtual_machine.go#L1138
Hi @fatspiderlinux
If the errors is directly from the Provider it means they intended this type to not be imported when that condition happens, at the end TerraCognita tries to use the provider defined import so there is not much we can do around that.
I've checked a bit deeper and there is no specific reason on the PR/Commit in which this was introduced.
it would be great if we had something to filter in Terracognita, maybe by using regex, we could only import vms which has not any "template" key on it's name, normally vsphere includes templates in the list of VM, by checking this API "/api/vcenter/vm" you can see it.
Hi, It's been a while but.. Did you find any solution to avoid all templates?
Hey, unfortunately not.
General information: Terracognita goes fine through all the resources but when it comes to vsphere_virtual_machine and a template is found it exits with an error.
Describe the bug:
I am trying to map existing vsphere infra and when I run terracognita specifying all the resources but vsphere_virtual_machine it works perfectly fine. When I try to discover virtual machines as well it exits with an error.
Log message
All good:
Borked: