Why we don't want to use diff in ResourceDiff
scheamMap.diff needs d (and a bunch of other stuff)
writers don't generally need this stuff
relationship should be
scheaMap -> resource helper -> reader/writer
Storing computed values in a pseudo-diff correctly
newValueWriter - A map[string]struct{Value interface{} Computed bool}
OR
type newValueWriter struct{
MapValueWriter
ComputedKeys map[string]struct{} (or map[string]bool)
}
Override ReadField with the following:
result, err := w.MapValueWriter.ReadField(addr)
if err != nil {
return result, err
}
if _, ok := m.ComputedKeys[strings.Join(addr, ".")]; ok {
result.Computed = true
}
return result, nil
Old values - go in a regular MapFieldWriter
SetDiff:
Wipe current diff
Set old and new values appropriately, including computed
Allow same values? Maybe.
SetNew/SetNewComputed
No change
ForceNew
Fixed to use schema
ClearAll
Clear whole diff
Clear
Main diff clearing logic (also used by SetDiff)
Get(Ok), HasChange, GetChange
Fixed to use readers
Id
Fixed to use readers