diff --git a/pkg/tfbridge/info/validate.go b/pkg/tfbridge/info/validate.go index ab558bb54..7a7e49681 100644 --- a/pkg/tfbridge/info/validate.go +++ b/pkg/tfbridge/info/validate.go @@ -116,7 +116,6 @@ func (c *infoCheck) checkProperty(path walk.SchemaPath, tfs shim.Schema, ps *Sch // To prevent confusion, users are barred from specifying information on // the associated Elem. All information should be specified directly on // this SchemaInfo. - // TODO: Wrong object check, what is the intention here? if obj, ok := util.CastToTypeObject(tfs); ok { if ps.Elem != nil { c.error(path, errElemForObject) diff --git a/pkg/tfbridge/info/validate_test.go b/pkg/tfbridge/info/validate_test.go index 93edab933..80bab1bef 100644 --- a/pkg/tfbridge/info/validate_test.go +++ b/pkg/tfbridge/info/validate_test.go @@ -39,7 +39,6 @@ func TestValidateNameOverride(t *testing.T) { Type: shim.TypeInt, }).Shim(), }).Shim(), - // TODO: This doesn't pass internal validate "object1": (&schema.Schema{ Type: shim.TypeMap, Elem: (&schema.Resource{ diff --git a/pkg/tfbridge/walk.go b/pkg/tfbridge/walk.go index 363565483..e70bc8346 100644 --- a/pkg/tfbridge/walk.go +++ b/pkg/tfbridge/walk.go @@ -22,7 +22,7 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/util" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/walk" md "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" @@ -94,7 +94,6 @@ func propertyPathToSchemaPathInner( // Detect single-nested blocks (object types). // // This is the case where (schema & schema.Elem) ~ {x: T}. - // TODO: Fix - the object type function is wrong. if res, isRes := util.CastToTypeObject(schema); isRes { return propertyPathToSchemaPath(basePath, propertyPath, res, schemaInfo.Fields) } @@ -215,7 +214,6 @@ func schemaPathToPropertyPathInner( } // Detect single-nested blocks (object types). - // TODO: Fix if obj, isObject := util.CastToTypeObject(schema); isObject { return schemaPathToPropertyPath(basePath, schemaPath, obj, schemaInfo.Fields) } diff --git a/pkg/tfshim/util/types.go b/pkg/tfshim/util/types.go index 9e676c9fd..1edfd22bc 100644 --- a/pkg/tfshim/util/types.go +++ b/pkg/tfshim/util/types.go @@ -15,7 +15,7 @@ package util import ( - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) // IsOfTypeMap detects schemas indicating a map[string,X] type. Due to a quirky encoding of @@ -25,9 +25,6 @@ func IsOfTypeMap(tfs shim.Schema) bool { if tfs == nil || tfs.Type() != shim.TypeMap { return false } - - // TODO: Can there be a map nested resource? - // This might be unused though _, hasResourceElem := tfs.Elem().(shim.Resource) return !hasResourceElem } @@ -41,8 +38,7 @@ func CastToTypeObject(tfs shim.Schema) (shim.SchemaMap, bool) { return nil, false } res, isRes := tfs.Elem().(shim.Resource) - // TODO: Map nested resources are not a thing, AFAIK - if isRes { + if isRes && tfs.Type() == shim.TypeMap { return res.Schema(), true } return nil, false