code: func (s *InstanceState) MergeDiff(d *InstanceDiff) *InstanceState {
  	result := s.DeepCopy()
  	if result == nil {
  		result = new(InstanceState)
  	}
  	result.init()
  
  	if s != nil {
  		s.Lock()
  		defer s.Unlock()
  		for k, v := range s.Attributes {
  			result.Attributes[k] = v
  		}
  	}
  	if d != nil {
  		for k, diff := range d.CopyAttributes() {
  			if diff.NewRemoved {
  				delete(result.Attributes, k)
  				continue
  			}
  			if diff.NewComputed {
  				result.Attributes[k] = config.UnknownVariableValue
  				continue
  			}
  
  			result.Attributes[k] = diff.New
  		}
  	}
  
  	return result
  }
docs: // MergeDiff takes a ResourceDiff and merges the attributes into
  // this resource state in order to generate a new state. This new
  // state can be used to provide updated attribute lookups for
  // variable interpolation.
  //
  // If the diff attribute requires computing the value, and hence
  // won't be available until apply, the value is replaced with the
  // computeID.