From b54efc220d9a8f7e54b915b46fe6f0a6f8d12e70 Mon Sep 17 00:00:00 2001 From: Hasan Turken Date: Thu, 3 Mar 2022 13:02:53 +0300 Subject: [PATCH] Fix cli conversion - collection elements could be nonprimitive Signed-off-by: Hasan Turken --- pkg/types/conversion/tfjson/tfjson.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/types/conversion/tfjson/tfjson.go b/pkg/types/conversion/tfjson/tfjson.go index 439802a3..99b5edbb 100644 --- a/pkg/types/conversion/tfjson/tfjson.go +++ b/pkg/types/conversion/tfjson/tfjson.go @@ -158,7 +158,10 @@ func schemaV2TypeFromCtyType(typ cty.Type, schema *schemav2.Schema) error { //no case et.IsPrimitiveType(): elemType = &schemav2.Schema{Type: primitiveToV2SchemaType(et)} case et.IsCollectionType(): - elemType = collectionToV2SchemaType(et) + elemType = &schemav2.Schema{Type: collectionToV2SchemaType(et)} + if err := schemaV2TypeFromCtyType(et, elemType.(*schemav2.Schema)); err != nil { + return err + } case et.IsObjectType(): res := &schemav2.Resource{} res.Schema = make(map[string]*schemav2.Schema, len(et.AttributeTypes()))