code: func (m *ModuleState) Orphans(c *configs.Module) []addrs.ResourceInstance {
  	m.Lock()
  	defer m.Unlock()
  
  	inConfig := make(map[string]struct{})
  	if c != nil {
  		for _, r := range c.ManagedResources {
  			inConfig[r.Addr().String()] = struct{}{}
  		}
  		for _, r := range c.DataResources {
  			inConfig[r.Addr().String()] = struct{}{}
  		}
  	}
  
  	var result []addrs.ResourceInstance
  	for k := range m.Resources {
  		// Since we've not yet updated state to use our new address format,
  		// we need to do some shimming here.
  		legacyAddr, err := parseResourceAddressInternal(k)
  		if err != nil {
  			// Suggests that the user tampered with the state, since we always
  			// generate valid internal addresses.
  			log.Printf("ModuleState has invalid resource key %q. Ignoring.", k)
  			continue
  		}
  
  		addr := legacyAddr.AbsResourceInstanceAddr().Resource
  		compareKey := addr.Resource.String() // compare by resource address, ignoring instance key
  		if _, exists := inConfig[compareKey]; !exists {
  			result = append(result, addr)
  		}
  	}
  	return result
  }
docs: // Orphans returns a list of keys of resources that are in the State
  // but aren't present in the configuration itself. Hence, these keys
  // represent the state of resources that are orphans.