code: func (addr *ResourceAddress) Contains(other *ResourceAddress) bool {
  	ourPath := addr.Path
  	givenPath := other.Path
  	if len(givenPath) < len(ourPath) {
  		return false
  	}
  	for i := range ourPath {
  		if ourPath[i] != givenPath[i] {
  			return false
  		}
  	}
  
  	// If the receiver is a whole-module address then the path prefix
  	// matching is all we need.
  	if !addr.HasResourceSpec() {
  		return true
  	}
  
  	if addr.Type != other.Type || addr.Name != other.Name || addr.Mode != other.Mode {
  		return false
  	}
  
  	if addr.Index != -1 && addr.Index != other.Index {
  		return false
  	}
  
  	if addr.InstanceTypeSet && (addr.InstanceTypeSet != other.InstanceTypeSet || addr.InstanceType != other.InstanceType) {
  		return false
  	}
  
  	return true
  }
docs: // Contains returns true if and only if the given node is contained within
  // the receiver.
  //
  // Containment is defined in terms of the module and resource heirarchy:
  // a resource is contained within its module and any ancestor modules,
  // an indexed resource instance is contained with the unindexed resource, etc.