diff --git a/cty/type.go b/cty/type.go index 4406908..fef1cfe 100644 --- a/cty/type.go +++ b/cty/type.go @@ -120,7 +120,7 @@ func (t Type) HasDynamicTypes() bool { // object types. This operation is applied recursively. func (t Type) WithoutOptionalAttributesDeep() Type { switch { - case t == DynamicPseudoType, t.IsPrimitiveType(), t.IsCapsuleType(): + case t == DynamicPseudoType, t == NilType, t.IsPrimitiveType(), t.IsCapsuleType(): return t case t.IsMapType(): return Map(t.ElementType().WithoutOptionalAttributesDeep()) diff --git a/cty/type_test.go b/cty/type_test.go index f5445a8..224d5d2 100644 --- a/cty/type_test.go +++ b/cty/type_test.go @@ -64,6 +64,10 @@ func TestWithoutOptionalAttributesDeep(t *testing.T) { DynamicPseudoType, DynamicPseudoType, }, + { + NilType, + NilType, + }, { List(DynamicPseudoType), List(DynamicPseudoType),