From 32974549cdf89b99499cdc3b95860d361297c963 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 28 Sep 2018 15:22:57 -0700 Subject: [PATCH] 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. --- plans/objchange/compatible.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plans/objchange/compatible.go b/plans/objchange/compatible.go index fda7d83a26..9298dc48e3 100644 --- a/plans/objchange/compatible.go +++ b/plans/objchange/compatible.go @@ -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"))