vsphere/resource_vsphere_virtual_machine.go
func resourceVSphereVirtualMachineRollbackCreate(
	d *schema.ResourceData,
	meta interface{},
	vm *object.VirtualMachine,
	origErr error,
) error {
	defer d.SetId("")
	// Updates are largely atomic, so more than likely no disks with
	// keep_on_remove were attached, but just in case, we run this through delete
	// to make sure to safely remove any disk that may have been attached as part
	// of this process if it was flagged as such.
	if err := resourceVSphereVirtualMachineDelete(d, meta); err != nil {
		return fmt.Errorf(formatVirtualMachinePostCloneRollbackError, vm.InventoryPath, origErr, err)
	}
	return fmt.Errorf("error reconfiguring virtual machine: %s", origErr)
}
func resourceVSphereVirtualMachineRollbackCreate(
	d *schema.ResourceData,
	meta interface{},
	vm *object.VirtualMachine,
	origErr error,
) error {
	defer d.SetId("")
	// Updates are largely atomic, so more than likely no disks with
	// keep_on_remove were attached, but just in case, we run this through delete
	// to make sure to safely remove any disk that may have been attached as part
	// of this process if it was flagged as such.
	if err := resourceVSphereVirtualMachineDelete(d, meta); err != nil {
		return fmt.Errorf(formatVirtualMachinePostCloneRollbackError, vm.InventoryPath, origErr, err)
	}
	return fmt.Errorf("error reconfiguring virtual machine: %s", origErr)
}
func resourceVSphereVirtualMachineRollbackCreate ( d * schema . ResourceData , meta interface { } , vm * object . VirtualMachine , origErr error , ) error { defer d . SetId ( " " ) // Updates are largely atomic, so more than likely no disks with // keep_on_remove were attached, but just in case, we run this through delete // to make sure to safely remove any disk that may have been attached as part // of this process if it was flagged as such. if err := resourceVSphereVirtualMachineDelete ( d , meta ) ; err != nil { return fmt . Errorf ( formatVirtualMachinePostCloneRollbackError , vm . InventoryPath , origErr , err ) } return fmt . Errorf ( " " , origErr ) }
// resourceVSphereVirtualMachineRollbackCreate attempts to "roll back" a
// resource due to an error that happened post-create that will put the VM in a
// state where it cannot be worked with. This should only be done early on in
// the process, namely on clone operations between when the clone actually
// happens, and no later than after the initial post-clone update is complete.
//
// If the rollback fails, an error is displayed prompting the user to manually
// delete the virtual machine before trying again.
resourceVSphereVirtualMachineRollbackCreate attempts to roll back a resource due to an error that happened post - create that will put the VM in a state where it cannot be worked with . This should only be done early on in the process namely on clone operations between when the clone actually happens and no later than after the initial post - clone update is complete . If the rollback fails an error is displayed prompting the user to manually delete the virtual machine before trying again .