plans/objchange: Fix handling of unknown in AssertValueCompatible

We need to check for the known-ness of the prior value before we check for
the null-ness of actual, because it's valid for an unknown value to become
a null.
pull/19086/head
Martin Atkins 8 years ago
parent 896b6bc897
commit 32974549cd

@ -176,6 +176,12 @@ func assertValueCompatible(planned, actual cty.Value, path cty.Path) []error {
return errs
}
if !planned.IsKnown() {
// We didn't know what were going to end up with during plan, so
// anything goes during apply.
return errs
}
if actual.IsNull() {
if planned.IsNull() {
return nil
@ -189,11 +195,6 @@ func assertValueCompatible(planned, actual cty.Value, path cty.Path) []error {
ty := planned.Type()
switch {
case ty == cty.DynamicPseudoType || !planned.IsKnown():
// We didn't know what were going to end up with during plan, so
// anything goes during apply.
return errs
case !actual.IsKnown():
errs = append(errs, path.NewErrorf("was known, but now unknown"))

Loading…
Cancel
Save