diff --git a/pkg/apis/resource/extension.go b/pkg/apis/resource/extension.go index 1d9ed39f4..e42a4220e 100644 --- a/pkg/apis/resource/extension.go +++ b/pkg/apis/resource/extension.go @@ -304,10 +304,20 @@ func (h Handler) getEndpointsFromOutput(ctx context.Context, id object.ID) ([]Ac Name: v.Name, }) case v.Schema.Type == openapi3.TypeArray: - if v.Schema.Items == nil || v.Schema.Items.Value == nil || - v.Schema.Items.Value.Type != openapi3.TypeString { - // For list and set: all elements are the same type. - return nil, invalidTypeErr + if v.Schema.Items != nil && v.Schema.Items.Value != nil { + // Array. + if v.Schema.Items.Value.Type != "" && v.Schema.Items.Value.Type != openapi3.TypeString { + return nil, invalidTypeErr + } + + // Tuple. + if len(v.Schema.Items.Value.OneOf) != 0 { + for _, sv := range v.Schema.Items.Value.OneOf { + if sv.Value != nil && sv.Value.Type != openapi3.TypeString { + return nil, invalidTypeErr + } + } + } } eps, _, err := property.GetSlice[string](v.Value) @@ -319,6 +329,10 @@ func (h Handler) getEndpointsFromOutput(ctx context.Context, id object.ID) ([]Ac return nil, err } + if len(eps) == 0 { + continue + } + endpoints = append(endpoints, AccessEndpoint{ Endpoints: eps, Name: v.Name, diff --git a/pkg/terraform/parser/parser.go b/pkg/terraform/parser/parser.go index 79f89095c..f449da0f0 100644 --- a/pkg/terraform/parser/parser.go +++ b/pkg/terraform/parser/parser.go @@ -225,15 +225,17 @@ func ParseStateOutput(revision *model.ResourceRevision) ([]types.OutputValue, er val = []byte(`""`) } + s := translator.SchemaOfType( + o.Type, + n, + nil, + "", + o.Sensitive, count) + outputs = append(outputs, types.OutputValue{ - Name: strings.TrimPrefix(n, sn+"_"), // Name format is serviceName_outputName. - Value: val, - Schema: translator.SchemaOfType( - o.Type, - n, - nil, - "", - o.Sensitive, count), + Name: strings.TrimPrefix(n, sn+"_"), // Name format is serviceName_outputName. + Value: val, + Schema: s, }) count++