func resourceVSphereVirtualMachineMigrateState(version int, os *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
	// Guard against a nil state.
	if os == nil {
		return nil, nil
	}

	// Guard against empty state, can't do anything with it
	if os.Empty() {
		return os, nil
	}

	var migrateFunc func(*terraform.InstanceState, interface{}) error
	switch version {
	case 2:
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: old v%d state: %#v", version, os)
		migrateFunc = migrateVSphereVirtualMachineStateV3
	case 1:
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: old v%d state: %#v", version, os)
		migrateFunc = migrateVSphereVirtualMachineStateV2
	case 0:
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: old v%d state: %#v", version, os)
		migrateFunc = migrateVSphereVirtualMachineStateV1
	default:
		// Migration is complete
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: completed v%d state: %#v", version, os)
		return os, nil
	}
	if err := migrateFunc(os, meta); err != nil {
		return nil, err
	}
	version++
	log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: new v%d state: %#v", version, os)
	return resourceVSphereVirtualMachineMigrateState(version, os, meta)
}
func resourceVSphereVirtualMachineMigrateState(version int, os *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
	
	if os == nil {
		return nil, nil
	}

	
	if os.Empty() {
		return os, nil
	}

	var migrateFunc func(*terraform.InstanceState, interface{}) error
	switch version {
	case 2:
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: old v%d state: %#v", version, os)
		migrateFunc = migrateVSphereVirtualMachineStateV3
	case 1:
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: old v%d state: %#v", version, os)
		migrateFunc = migrateVSphereVirtualMachineStateV2
	case 0:
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: old v%d state: %#v", version, os)
		migrateFunc = migrateVSphereVirtualMachineStateV1
	default:
		
		log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: completed v%d state: %#v", version, os)
		return os, nil
	}
	if err := migrateFunc(os, meta); err != nil {
		return nil, err
	}
	version++
	log.Printf("[DEBUG] Migrating vsphere_virtual_machine state: new v%d state: %#v", version, os)
	return resourceVSphereVirtualMachineMigrateState(version, os, meta)
}
func resourceVSphereVirtualMachineMigrateState ( version int , os * terraform . InstanceState , meta interface { } ) ( * terraform . InstanceState , error ) { // Guard against a nil state. if os == nil { return nil , nil } // Guard against empty state, can't do anything with it if os . Empty ( ) { return os , nil } var migrateFunc func ( * terraform . InstanceState , interface { } ) error switch version { case 2 : log . Printf ( " " , version , os ) migrateFunc = migrateVSphereVirtualMachineStateV3 case 1 : log . Printf ( " " , version , os ) migrateFunc = migrateVSphereVirtualMachineStateV2 case 0 : log . Printf ( " " , version , os ) migrateFunc = migrateVSphereVirtualMachineStateV1 default : // Migration is complete log . Printf ( " " , version , os ) return os , nil } if err := migrateFunc ( os , meta ) ; err != nil { return nil , err } version ++ log . Printf ( " " , version , os ) return resourceVSphereVirtualMachineMigrateState ( version , os , meta ) }
// resourceVSphereVirtualMachineMigrateState is the master state migration function for
// the vsphere_virtual_machine resource.
resourceVSphereVirtualMachineMigrateState is the master state migration function for the vsphere_virtual_machine resource .