restore lost unknowns during a planned update.

Because schema.ResourceDiff can't differentiate between unknown
values and new computed values, unknowns can be lost during an update.
If a planned value converted an unknown to a null, restore the unknown
so that it can be correctly replaced in the final plan.
pull/20874/head
James Bardin 7 years ago
parent 8b9fa6d05f
commit 009df443f7

@ -1144,6 +1144,14 @@ func normalizeNullValues(dst, src cty.Value, preferDst bool) cty.Value {
ty := dst.Type()
if !src.IsNull() && !src.IsKnown() {
// While this seems backwards to return src when preferDst is set, it
// means this might be a plan scenario, and it must retain unknown
// interpolated placeholders, which could be lost if we're only updating
// a resource. If this is a read scenario, then there shouldn't be any
// unknowns all.
if dst.IsNull() && preferDst {
return src
}
return dst
}

Loading…
Cancel
Save