diff --git a/cty/convert/conversion_object.go b/cty/convert/conversion_object.go index e356489a..51958ef4 100644 --- a/cty/convert/conversion_object.go +++ b/cty/convert/conversion_object.go @@ -80,7 +80,9 @@ func conversionObjectToObject(in, out cty.Type, unsafe bool) conversion { } } - if val.Equals(cty.NullVal(val.Type())).True() { + if val.IsNull() { + // Strip optional attributes out of the embedded type for null + // values. val = cty.NullVal(val.Type().WithoutOptionalAttributesDeep()) }