Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helper/schema: Add Computed to ResourceDiff, expose GetOkExists
This adds a new method to ResourceDiff: Computed, which exposes the computed read result field to ResourceDiff. In the context of customizing the diff, this is important as interpolated and otherwise computed values will show up in the diff as blank, with no way of determining if the value is actually blank or if it's a computed value not available at diff customization time. Currently assumptions need to be made on this, but this does not help in validation scenarios where one needs to differentiate between an actual blank value and a value that will be available later. This is exposed for the most part via NewComputed in the diff, but the tests cover both the config reader as well (with no diff, even though this should not come up in normal operation) and also the newDiff reader when someone sets a new value using SetNew and SetNewComputed. This commit also exposes GetOkExists. The tests were mostly pulled from ResourceData but a few were added to ensure that config was being properly covered as well, in addition to covering SetNew and SetNewComputed.
- Loading branch information