code: func (c *StateMvCommand) sourceObjectAddrs(state *states.State, matched addrs.Targetable) []addrs.Targetable {
  	var ret []addrs.Targetable
  
  	switch addr := matched.(type) {
  	case addrs.ModuleInstance:
  		for _, mod := range state.Modules {
  			if len(mod.Addr) < len(addr) {
  				continue // can't possibly be our selection or a child of it
  			}
  			if !mod.Addr[:len(addr)].Equal(addr) {
  				continue
  			}
  			ret = append(ret, mod.Addr)
  		}
  	case addrs.AbsResource:
  		// If this refers to a resource without "count" or "for_each" set then
  		// we'll assume the user intended it to be a resource instance
  		// address instead, to allow for requests like this:
  		//   terraform state mv aws_instance.foo aws_instance.bar[1]
  		// That wouldn't be allowed if aws_instance.foo had multiple instances
  		// since we can't move multiple instances into one.
  		if rs := state.Resource(addr); rs != nil && rs.EachMode == states.NoEach {
  			ret = append(ret, addr.Instance(addrs.NoKey))
  		} else {
  			ret = append(ret, addr)
  		}
  	default:
  		ret = append(ret, matched)
  	}
  
  	return ret
  }
docs: // sourceObjectAddrs takes a single source object address and expands it to
  // potentially multiple objects that need to be handled within it.
  //
  // In particular, this handles the case where a module is requested directly:
  // if it has any child modules, then they must also be moved. It also resolves
  // the ambiguity that an index-less resource address could either be a resource
  // address or a resource instance address, by making a decision about which
  // is intended based on the current state of the resource in question.