code: func (addr *ResourceAddress) AbsResourceInstanceAddr() addrs.AbsResourceInstance {
  	if !addr.HasResourceSpec() {
  		panic("AbsResourceInstanceAddr called on ResourceAddress with no resource spec")
  	}
  
  	ret := addrs.AbsResourceInstance{
  		Module: addr.ModuleInstanceAddr(),
  		Resource: addrs.ResourceInstance{
  			Resource: addrs.Resource{
  				Type: addr.Type,
  				Name: addr.Name,
  			},
  		},
  	}
  
  	switch addr.Mode {
  	case config.ManagedResourceMode:
  		ret.Resource.Resource.Mode = addrs.ManagedResourceMode
  	case config.DataResourceMode:
  		ret.Resource.Resource.Mode = addrs.DataResourceMode
  	default:
  		panic(fmt.Errorf("cannot shim %s to addrs.ResourceMode value", addr.Mode))
  	}
  
  	if addr.Index != -1 {
  		ret.Resource.Key = addrs.IntKey(addr.Index)
  	}
  
  	return ret
  }
docs: // AbsResourceInstanceAddr converts the receiver, a legacy resource address, to
  // the new resource address type addrs.AbsResourceInstance.
  //
  // This method can be used only on an address that has a resource specification.
  // It will panic if called on a module-path-only ResourceAddress. Use
  // method HasResourceSpec to check before calling, in contexts where it is
  // unclear.
  //
  // addrs.AbsResourceInstance does not represent the "tainted" and "deposed"
  // states, and so if these are present on the receiver then they are discarded.
  //
  // This is provided for shimming purposes so that we can easily adapt functions
  // that are returning the legacy ResourceAddress type, for situations where
  // the new type is required.