code: func (r *ResourceAddress) MatchesResourceConfig(path addrs.Module, rc *configs.Resource) bool {
  	if r.HasResourceSpec() {
  		// FIXME: Some ugliness while we are between worlds. Functionality
  		// in "addrs" should eventually replace this ResourceAddress idea
  		// completely, but for now we'll need to translate to the old
  		// way of representing resource modes.
  		switch r.Mode {
  		case config.ManagedResourceMode:
  			if rc.Mode != addrs.ManagedResourceMode {
  				return false
  			}
  		case config.DataResourceMode:
  			if rc.Mode != addrs.DataResourceMode {
  				return false
  			}
  		}
  		if r.Type != rc.Type || r.Name != rc.Name {
  			return false
  		}
  	}
  
  	addrPath := r.Path
  
  	// normalize
  	if len(addrPath) == 0 {
  		addrPath = nil
  	}
  	if len(path) == 0 {
  		path = nil
  	}
  	rawPath := []string(path)
  	return reflect.DeepEqual(addrPath, rawPath)
  }
docs: // MatchesResourceConfig returns true if the receiver matches the given
  // configuration resource within the given _static_ module path. Note that
  // the module path in a resource address is a _dynamic_ module path, and
  // multiple dynamic resource paths may map to a single static path if
  // count and for_each are in use on module calls.
  //
  // Since resource configuration blocks represent all of the instances of
  // a multi-instance resource, the index of the address (if any) is not
  // considered.