From f49006e4c378f3bc6c6c0e9643f96eedfe05f864 Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Wed, 19 Oct 2022 09:03:50 +0200 Subject: [PATCH] better checking for null --- cty/convert/conversion_object.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()) }