Hello,
what is the procedure to import an existing VM into terraform in its entirety and have terraform accept the imported VMs configuration as its desired configuration?
I’ve have done the following:
- Create an empty resource:
resource “vsphere_virtual_machine” “vm-import” {
}
- Import the resource, which succeeds
terraform import vsphere_virtual_machine.vm-import /dc-cr/vm/87-92-79
Now, after this when running terraform plan, I get errors about missing attributes in the configured resource, which is indeed empty but all the settings are there in the imported state.
I have also tried
- Dumping the state file resource data into a resource configuration.
terraform state show vsphere_virtual_machine.vm-import > vm-import.tf -no-color
When running “plan” with this file, I now get errors about unconfigurable resources being set
- Tried deleting the empty resource “vsphere_virtual_machine” “vm-import” from the config. Now when running “plan” terraform informs that the vm will be deleted.
TIA