diff --git a/operator/builtin/output/googlecloud/proto.go b/operator/builtin/output/googlecloud/proto.go index b9561dab7..287278d69 100644 --- a/operator/builtin/output/googlecloud/proto.go +++ b/operator/builtin/output/googlecloud/proto.go @@ -55,6 +55,20 @@ func toProto(v interface{}) (*structpb.Value, error) { for key, value := range v { fields[key] = structpb.NewStringValue(value) } + return structpb.NewStructValue(&structpb.Struct{ + Fields: fields, + }), nil + case map[string]map[string]string: + fields := map[string]*structpb.Value{} + for key, value := range v { + proto, err := toProto(value) + if err != nil { + return nil, err + } + + fields[key] = proto + } + return structpb.NewStructValue(&structpb.Struct{ Fields: fields, }), nil diff --git a/operator/builtin/output/googlecloud/proto_test.go b/operator/builtin/output/googlecloud/proto_test.go index 9aecf4493..91db84fd8 100644 --- a/operator/builtin/output/googlecloud/proto_test.go +++ b/operator/builtin/output/googlecloud/proto_test.go @@ -63,6 +63,23 @@ func TestToProto(t *testing.T) { }, }), }, + { + name: "map[string]map[string]string", + value: map[string]map[string]string{ + "test": { + "key": "value", + }, + }, + expectedValue: structpb.NewStructValue(&structpb.Struct{ + Fields: map[string]*structpb.Value{ + "test": structpb.NewStructValue(&structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key": structpb.NewStringValue("value"), + }, + }), + }, + }), + }, { name: "interface list", value: []interface{}{"value", 1},