code: func LegacyInstanceObjectID(obj *ResourceInstanceObjectSrc) string {
  	if obj == nil {
  		return "<not created>"
  	}
  
  	if obj.AttrsJSON != nil {
  		type WithID struct {
  			ID string `json:"id"`
  		}
  		var withID WithID
  		err := json.Unmarshal(obj.AttrsJSON, &withID)
  		if err == nil {
  			return withID.ID
  		}
  	} else if obj.AttrsFlat != nil {
  		if flatID, exists := obj.AttrsFlat["id"]; exists {
  			return flatID
  		}
  	}
  
  	// For resource types created after we removed id as special there may
  	// not actually be one at all. This is okay because older tests won't
  	// encounter this, and new tests shouldn't be using ids.
  	return "<none>"
  }
docs: // LegacyInstanceObjectID is a helper for extracting an object id value from
  // an instance object in a way that approximates how we used to do this
  // for the old state types. ID is no longer first-class, so this is preserved
  // only for compatibility with old tests that include the id as part of their
  // expected value.