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.
This commit is contained in:
parent
896b6bc897
commit
32974549cd
|
@ -176,6 +176,12 @@ func assertValueCompatible(planned, actual cty.Value, path cty.Path) []error {
|
||||||
return errs
|
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 actual.IsNull() {
|
||||||
if planned.IsNull() {
|
if planned.IsNull() {
|
||||||
return nil
|
return nil
|
||||||
|
@ -189,11 +195,6 @@ func assertValueCompatible(planned, actual cty.Value, path cty.Path) []error {
|
||||||
ty := planned.Type()
|
ty := planned.Type()
|
||||||
switch {
|
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():
|
case !actual.IsKnown():
|
||||||
errs = append(errs, path.NewErrorf("was known, but now unknown"))
|
errs = append(errs, path.NewErrorf("was known, but now unknown"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue