terraform/plans
Martin Atkins c794bf5bcc plans/objchange: Don't presume unknown for values unset in config
Previously we would construct a proposed new state with unknown values in
place of any not-set-in-config computed attributes, trying to save the
provider a little work in specifying that itself.

Unfortunately that turns out to be problematic because it conflates two
concerns: attributes can be explicitly set in configuration to an unknown
value, in which case the final result of that unknown overrides any
default value the provider might normally populate.

In other words, this allows the provider to recognize in the proposed new
state the difference between an Optional+Computed attribute being set to
unknown in the config vs not being set in the config at all.

The provider now has the responsibility to replace these proposed null
values with unknown values during PlanResourceChange if it expects to
select a value during the apply step. It may also populate a known value
if the final result can be predicted at plan time, as is the case for
constant defaults specified in the provider code.

This change comes from a realization that from core's perspective the
helper/schema ideas of zero values, explicit default values, and
customizediff tweaks are all just examples of "defaults", and by allowing
the provider to see during plan whether these attributes are being
explicitly set in configuration and thus decide whether the default will
be provided immediately during plan or deferred until apply.
2019-02-07 14:01:39 -08:00
..
internal/planproto build: Take protoc out of the "go generate" path 2018-10-18 10:39:20 -07:00
objchange plans/objchange: Don't presume unknown for values unset in config 2019-02-07 14:01:39 -08:00
planfile test for destroy plan round trip 2018-12-20 15:11:08 -05:00
action.go core: Handle forced-create_before_destroy during the plan walk 2018-10-16 19:14:11 -07:00
action_string.go plans: Regenerate Action.String for new action values 2018-10-16 19:14:11 -07:00
changes.go plans: OutputChange.Encode must preserve Addr field 2018-11-01 17:33:10 -07:00
changes_src.go don't attempt to decode empty changes values 2018-12-20 13:06:53 -05:00
changes_state.go plans: New package for in-memory plan models 2018-10-16 18:50:29 -07:00
changes_sync.go core: Allow planned output changes to be updated during apply 2018-11-05 16:02:45 -08:00
doc.go plans: New package for in-memory plan models 2018-10-16 18:50:29 -07:00
dynamic_value.go don't convert empty DynamicValue to nil 2018-12-20 10:28:26 -05:00
dynamic_value_test.go plans: New package for in-memory plan models 2018-10-16 18:50:29 -07:00
plan.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
plan_test.go make Changes.Empty() not count NoOps 2018-10-16 19:14:11 -07:00