From 746aac8bdaa39a5ebe2d97916fd08dd32582bd3e Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 2 Apr 2019 15:43:48 -0400 Subject: [PATCH] increase grpc recv limit Some providers may generate quite large schemas, and the internal default grpc response size limit is 4MB. 64MB should cover most any use case, and if we get providers nearing that we may want to consider a finer-grained API to fetch individual resource schemas. --- plugin/grpc_provider.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/grpc_provider.go b/plugin/grpc_provider.go index 26e84e9e78..96409d7120 100644 --- a/plugin/grpc_provider.go +++ b/plugin/grpc_provider.go @@ -119,7 +119,13 @@ func (p *GRPCProvider) GetSchema() (resp providers.GetSchemaResponse) { resp.ResourceTypes = make(map[string]providers.Schema) resp.DataSources = make(map[string]providers.Schema) - protoResp, err := p.client.GetSchema(p.ctx, new(proto.GetProviderSchema_Request)) + // Some providers may generate quite large schemas, and the internal default + // grpc response size limit is 4MB. 64MB should cover most any use case, and + // if we get providers nearing that we may want to consider a finer-grained + // API to fetch individual resource schemas. + // Note: this option is marked as EXPERIMENTAL in the grpc API. + const maxRecvSize = 64 << 20 + protoResp, err := p.client.GetSchema(p.ctx, new(proto.GetProviderSchema_Request), grpc.MaxRecvMsgSizeCallOption{MaxRecvMsgSize: maxRecvSize}) if err != nil { resp.Diagnostics = resp.Diagnostics.Append(err) return resp