Skip to content

Commit c856280

Browse files
committed
update server capabilities
1 parent e6b545a commit c856280

File tree

5 files changed

+38
-19
lines changed

5 files changed

+38
-19
lines changed

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ toolchain go1.24.4
66

77
require (
88
github.com/google/go-cmp v0.7.0
9-
github.com/hashicorp/terraform-plugin-go v0.29.0
9+
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251112131031-c841d34ce2f2
1010
github.com/hashicorp/terraform-plugin-log v0.9.0
11-
google.golang.org/grpc v1.75.1
11+
google.golang.org/grpc v1.76.0
1212
)
1313

1414
require (
@@ -29,6 +29,6 @@ require (
2929
golang.org/x/net v0.43.0 // indirect
3030
golang.org/x/sys v0.35.0 // indirect
3131
golang.org/x/text v0.28.0 // indirect
32-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
33-
google.golang.org/protobuf v1.36.9 // indirect
32+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
33+
google.golang.org/protobuf v1.36.10 // indirect
3434
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshf
2323
github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
2424
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
2525
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
26-
github.com/hashicorp/terraform-plugin-go v0.29.0 h1:1nXKl/nSpaYIUBU1IG/EsDOX0vv+9JxAltQyDMpq5mU=
27-
github.com/hashicorp/terraform-plugin-go v0.29.0/go.mod h1:vYZbIyvxyy0FWSmDHChCqKvI40cFTDGSb3D8D70i9GM=
26+
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251112131031-c841d34ce2f2 h1:GxLILx5hl084NZFVBc6rdzKrJ5DL8MYNaQapmXFcOHY=
27+
github.com/hashicorp/terraform-plugin-go v0.29.1-0.20251112131031-c841d34ce2f2/go.mod h1:KHRnT9vExG+r1fLxwOzOP6C6YXiaKHtsCIrky7teDYc=
2828
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
2929
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
3030
github.com/hashicorp/terraform-registry-address v0.4.0 h1:S1yCGomj30Sao4l5BMPjTGZmCNzuv7/GDTDX99E9gTk=
@@ -86,12 +86,12 @@ golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
8686
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
8787
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
8888
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
89-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 h1:pFyd6EwwL2TqFf8emdthzeX+gZE1ElRq3iM8pui4KBY=
90-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
91-
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
92-
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
93-
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
94-
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
89+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b h1:zPKJod4w6F1+nRGDI9ubnXYhU9NSWoFAijkHkUXeTK8=
90+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
91+
google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A=
92+
google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c=
93+
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
94+
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
9595
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9696
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
9797
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

tf5muxserver/mux_server.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"context"
88
"sync"
99

10-
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1110
"google.golang.org/grpc/codes"
1211
"google.golang.org/grpc/status"
1312

13+
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
1414
"github.com/hashicorp/terraform-plugin-mux/internal/logging"
1515
)
1616

@@ -29,9 +29,6 @@ type muxServer struct {
2929
// Routing for ephemeral resource types
3030
ephemeralResources map[string]tfprotov5.ProviderServer
3131

32-
// Routing for generating resource configuration
33-
generateResourceConfig map[string]tfprotov5.ProviderServer
34-
3532
// Routing for list resource types
3633
listResources map[string]tfprotov5.ProviderServer
3734

tf5muxserver/mux_server_GenerateResourceConfig.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
14
package tf5muxserver
25

36
import (
47
"context"
5-
//"fmt"
68

7-
//"github.com/hashicorp/terraform-plugin-framework/providerserver"
89
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
910
"github.com/hashicorp/terraform-plugin-mux/internal/logging"
1011
)
@@ -27,5 +28,25 @@ func (s *muxServer) GenerateResourceConfig(ctx context.Context, req *tfprotov5.G
2728
}, nil
2829
}
2930

30-
return server.GenerateResourceConfig(ctx, req)
31+
// TODO: Remove and call server.GenerateResourceConfig below directly once interface becomes required.
32+
generateResourceConfigServer, ok := server.(tfprotov5.GenerateResourceConfigServer)
33+
if !ok {
34+
resp := &tfprotov5.GenerateResourceConfigResponse{
35+
Diagnostics: []*tfprotov5.Diagnostic{
36+
{
37+
Severity: tfprotov5.DiagnosticSeverityError,
38+
Summary: "GenerateResourceConfig Not Implemented",
39+
Detail: "A GenerateResourceConfig call was received by the provider, however the provider does not implement GenerateResourceConfig. " +
40+
"Either upgrade the provider to a version that implements GenerateResourceConfig or this is a bug in Terraform that should be reported to the Terraform maintainers.",
41+
},
42+
},
43+
}
44+
45+
return resp, nil
46+
}
47+
48+
ctx = logging.Tfprotov5ProviderServerContext(ctx, server)
49+
logging.MuxTrace(ctx, "calling downstream server")
50+
51+
return generateResourceConfigServer.GenerateResourceConfig(ctx, req)
3152
}

tf5muxserver/server_capabilities.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var serverCapabilities = &tfprotov5.ServerCapabilities{
1212
GetProviderSchemaOptional: true,
1313
MoveResourceState: true,
1414
PlanDestroy: true,
15+
GenerateResourceConfig: true,
1516
}
1617

1718
// serverSupportsPlanDestroy returns true if the given ServerCapabilities is not

0 commit comments

Comments
 (0)