Skip to content

Commit e2f2af1

Browse files
authored
Update terraform-plugin-go and add changelogs for v0.20.0 release (#307)
* update deps + add changelog * update plugin go
1 parent 4351d29 commit e2f2af1

15 files changed

+29
-205
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: BUG FIXES
2+
body: 'all: Fixed a bug where muxed provider servers were not enforced to implement `GetResourceIdentitySchemas`, which is
3+
required by Terraform v1.12.1 in the scenario where at least one of the muxed provider servers supports identity. Before upgrading this dependency
4+
the Go modules that support identity should also be upgraded to prevent confusing errors, which are: terraform-plugin-go@v0.28.0, terraform-plugin-framework@v1.15.0,
5+
terraform-plugin-sdk/v2@v2.37.0, and terraform-plugin-testing@v1.13.0.'
6+
time: 2025-05-21T15:13:05.963451-04:00
7+
custom:
8+
Issue: "307"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.23.7
66

77
require (
88
github.com/google/go-cmp v0.7.0
9-
github.com/hashicorp/terraform-plugin-go v0.27.0
9+
github.com/hashicorp/terraform-plugin-go v0.28.0
1010
github.com/hashicorp/terraform-plugin-log v0.9.0
1111
google.golang.org/grpc v1.72.1
1212
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0U
2121
github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0=
2222
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
2323
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
24-
github.com/hashicorp/terraform-plugin-go v0.27.0 h1:ujykws/fWIdsi6oTUT5Or4ukvEan4aN9lY+LOxVP8EE=
25-
github.com/hashicorp/terraform-plugin-go v0.27.0/go.mod h1:FDa2Bb3uumkTGSkTFpWSOwWJDwA7bf3vdP3ltLDTH6o=
24+
github.com/hashicorp/terraform-plugin-go v0.28.0 h1:zJmu2UDwhVN0J+J20RE5huiF3XXlTYVIleaevHZgKPA=
25+
github.com/hashicorp/terraform-plugin-go v0.28.0/go.mod h1:FDa2Bb3uumkTGSkTFpWSOwWJDwA7bf3vdP3ltLDTH6o=
2626
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
2727
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
2828
github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M=

tf5muxserver/mux_server_GetResourceIdentitySchemas.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,7 @@ func (s *muxServer) GetResourceIdentitySchemas(ctx context.Context, req *tfproto
3030
ctx := logging.Tfprotov5ProviderServerContext(ctx, server)
3131
logging.MuxTrace(ctx, "calling downstream server")
3232

33-
// TODO: Remove and call server.GetResourceIdentitySchemas below directly once interface becomes required.
34-
//nolint:staticcheck // Intentionally verifying interface implementation
35-
resourceIdentityServer, ok := server.(tfprotov5.ProviderServerWithResourceIdentity)
36-
37-
if !ok {
38-
resp.Diagnostics = append(resp.Diagnostics, &tfprotov5.Diagnostic{
39-
Severity: tfprotov5.DiagnosticSeverityError,
40-
Summary: "GetResourceIdentitySchemas Not Implemented",
41-
Detail: "A GetResourceIdentitySchemas call was received by the provider, however the provider does not implement GetResourceIdentitySchemas. " +
42-
"Either upgrade the provider to a version that implements GetResourceIdentitySchemas or this is a bug in Terraform that should be reported to the Terraform maintainers.",
43-
})
44-
45-
continue
46-
}
47-
48-
resourceIdentitySchemas, err := resourceIdentityServer.GetResourceIdentitySchemas(ctx, req)
33+
resourceIdentitySchemas, err := server.GetResourceIdentitySchemas(ctx, req)
4934

5035
if err != nil {
5136
return resp, fmt.Errorf("error calling GetResourceIdentitySchemas for %T: %w", server, err)

tf5muxserver/mux_server_GetResourceIdentitySchemas_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,7 @@ func TestMuxServerGetResourceIdentitySchema(t *testing.T) {
345345
t.Fatalf("unexpected error: %s", err)
346346
}
347347

348-
//nolint:staticcheck // Intentionally verifying interface implementation
349-
resourceIdentityServer, ok := muxServer.ProviderServer().(tfprotov5.ProviderServerWithResourceIdentity)
350-
if !ok {
351-
t.Fatal("muxServer should implement tfprotov5.ProviderServerWithResourceIdentity")
352-
}
353-
354-
resp, err := resourceIdentityServer.GetResourceIdentitySchemas(context.Background(), &tfprotov5.GetResourceIdentitySchemasRequest{})
348+
resp, err := muxServer.ProviderServer().GetResourceIdentitySchemas(context.Background(), &tfprotov5.GetResourceIdentitySchemasRequest{})
355349

356350
if err != nil {
357351
t.Fatalf("unexpected error: %s", err)

tf5muxserver/mux_server_UpgradeResourceIdentity.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,8 @@ func (s *muxServer) UpgradeResourceIdentity(ctx context.Context, req *tfprotov5.
3030
}, nil
3131
}
3232

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

54-
return resourceIdentityServer.UpgradeResourceIdentity(ctx, req)
36+
return server.UpgradeResourceIdentity(ctx, req)
5537
}

tf5muxserver/mux_server_UpgradeResourceIdentity_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,7 @@ func TestMuxServerUpgradeResourceIdentity(t *testing.T) {
4949
t.Fatalf("unexpected error setting up factory: %s", err)
5050
}
5151

52-
//nolint:staticcheck // Intentionally verifying interface implementation
53-
resourceIdentityServer, ok := muxServer.ProviderServer().(tfprotov5.ProviderServerWithResourceIdentity)
54-
if !ok {
55-
t.Fatal("muxServer should implement tfprotov5.ProviderServerWithEphemeralResources")
56-
}
57-
58-
_, err = resourceIdentityServer.UpgradeResourceIdentity(ctx, &tfprotov5.UpgradeResourceIdentityRequest{
52+
_, err = muxServer.ProviderServer().UpgradeResourceIdentity(ctx, &tfprotov5.UpgradeResourceIdentityRequest{
5953
TypeName: "test_resource_server1",
6054
})
6155

@@ -71,7 +65,7 @@ func TestMuxServerUpgradeResourceIdentity(t *testing.T) {
7165
t.Errorf("unexpected test_resource_server1 UpgradeResourceIdentity called on server2")
7266
}
7367

74-
_, err = resourceIdentityServer.UpgradeResourceIdentity(ctx, &tfprotov5.UpgradeResourceIdentityRequest{
68+
_, err = muxServer.ProviderServer().UpgradeResourceIdentity(ctx, &tfprotov5.UpgradeResourceIdentityRequest{
7569
TypeName: "test_resource_server2",
7670
})
7771

tf5to6server/tf5to6server.go

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,9 @@ func (s v5tov6Server) GetProviderSchema(ctx context.Context, req *tfprotov6.GetP
111111
}
112112

113113
func (s v5tov6Server) GetResourceIdentitySchemas(ctx context.Context, req *tfprotov6.GetResourceIdentitySchemasRequest) (*tfprotov6.GetResourceIdentitySchemasResponse, error) {
114-
// TODO: Remove and call s.v6Server.GetResourceIdentitySchemas below directly once interface becomes required
115-
//nolint:staticcheck // Intentionally verifying interface implementation
116-
resourceIdentityServer, ok := s.v5Server.(tfprotov5.ProviderServerWithResourceIdentity)
117-
if !ok {
118-
v6Resp := &tfprotov6.GetResourceIdentitySchemasResponse{
119-
Diagnostics: []*tfprotov6.Diagnostic{
120-
{
121-
Severity: tfprotov6.DiagnosticSeverityError,
122-
Summary: "GetResourceIdentitySchemas Not Implemented",
123-
Detail: "A GetResourceIdentitySchemas call was received by the provider, however the provider does not implement the RPC. " +
124-
"Either upgrade the provider to a version that implements GetResourceIdentitySchemas or this is a bug in Terraform that should be reported to the Terraform maintainers.",
125-
},
126-
},
127-
}
128-
129-
return v6Resp, nil
130-
}
131114

132115
v5Req := tfprotov6tov5.GetResourceIdentitySchemasRequest(req)
133-
v5Resp, err := resourceIdentityServer.GetResourceIdentitySchemas(ctx, v5Req)
116+
v5Resp, err := s.v5Server.GetResourceIdentitySchemas(ctx, v5Req)
134117

135118
if err != nil {
136119
return nil, err
@@ -244,25 +227,8 @@ func (s v5tov6Server) UpgradeResourceState(ctx context.Context, req *tfprotov6.U
244227
}
245228

246229
func (s v5tov6Server) UpgradeResourceIdentity(ctx context.Context, req *tfprotov6.UpgradeResourceIdentityRequest) (*tfprotov6.UpgradeResourceIdentityResponse, error) {
247-
//nolint:staticcheck // Intentionally verifying interface implementation
248-
resourceIdentityServer, ok := s.v5Server.(tfprotov5.ProviderServerWithResourceIdentity)
249-
if !ok {
250-
v6Resp := &tfprotov6.UpgradeResourceIdentityResponse{
251-
Diagnostics: []*tfprotov6.Diagnostic{
252-
{
253-
Severity: tfprotov6.DiagnosticSeverityError,
254-
Summary: "UpgradeResourceIdentity Not Implemented",
255-
Detail: "A UpgradeResourceIdentity call was received by the provider, however the provider does not implement the RPC. " +
256-
"Either upgrade the provider to a version that implements UpgradeResourceIdentity or this is a bug in Terraform that should be reported to the Terraform maintainers.",
257-
},
258-
},
259-
}
260-
261-
return v6Resp, nil
262-
}
263-
264230
v5Req := tfprotov6tov5.UpgradeResourceIdentityRequest(req)
265-
v5Resp, err := resourceIdentityServer.UpgradeResourceIdentity(ctx, v5Req)
231+
v5Resp, err := s.v5Server.UpgradeResourceIdentity(ctx, v5Req)
266232

267233
if err != nil {
268234
return nil, err

tf5to6server/tf5to6server_test.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,7 @@ func TestV6ToV5ServerGetResourceIdentitySchemas(t *testing.T) {
356356
t.Fatalf("unexpected error downgrading server: %s", err)
357357
}
358358

359-
//nolint:staticcheck // Intentionally verifying interface implementation
360-
resourceIdentityServer, ok := v6server.(tfprotov6.ProviderServerWithResourceIdentity)
361-
if !ok {
362-
t.Fatal("v6server should implement tfprotov6.ProviderServerWithResourceIdentity")
363-
}
364-
365-
_, err = resourceIdentityServer.GetResourceIdentitySchemas(ctx, &tfprotov6.GetResourceIdentitySchemasRequest{})
359+
_, err = v6server.GetResourceIdentitySchemas(ctx, &tfprotov6.GetResourceIdentitySchemasRequest{})
366360

367361
if err != nil {
368362
t.Fatalf("unexpected error: %s", err)
@@ -668,13 +662,7 @@ func TestV6ToV5ServerUpgradeResourceIdentity(t *testing.T) {
668662
t.Fatalf("unexpected error downgrading server: %s", err)
669663
}
670664

671-
//nolint:staticcheck // Intentionally verifying interface implementation
672-
resourceIdentityServer, ok := v6server.(tfprotov6.ProviderServerWithResourceIdentity)
673-
if !ok {
674-
t.Fatal("v6server should implement tfprotov6.ProviderServerWithResourceIdentity")
675-
}
676-
677-
_, err = resourceIdentityServer.UpgradeResourceIdentity(ctx, &tfprotov6.UpgradeResourceIdentityRequest{
665+
_, err = v6server.UpgradeResourceIdentity(ctx, &tfprotov6.UpgradeResourceIdentityRequest{
678666
TypeName: "test_resource",
679667
})
680668

tf6muxserver/mux_server_GetResourceIdentitySchemas.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,7 @@ func (s *muxServer) GetResourceIdentitySchemas(ctx context.Context, req *tfproto
3030
ctx := logging.Tfprotov6ProviderServerContext(ctx, server)
3131
logging.MuxTrace(ctx, "calling downstream server")
3232

33-
// TODO: Remove and call server.GetResourceIdentitySchemas below directly once interface becomes required.
34-
//nolint:staticcheck // Intentionally verifying interface implementation
35-
resourceIdentityServer, ok := server.(tfprotov6.ProviderServerWithResourceIdentity)
36-
37-
if !ok {
38-
resp.Diagnostics = append(resp.Diagnostics, &tfprotov6.Diagnostic{
39-
Severity: tfprotov6.DiagnosticSeverityError,
40-
Summary: "GetResourceIdentitySchemas Not Implemented",
41-
Detail: "A GetResourceIdentitySchemas call was received by the provider, however the provider does not implement GetResourceIdentitySchemas. " +
42-
"Either upgrade the provider to a version that implements GetResourceIdentitySchemas or this is a bug in Terraform that should be reported to the Terraform maintainers.",
43-
})
44-
45-
continue
46-
}
47-
48-
resourceIdentitySchemas, err := resourceIdentityServer.GetResourceIdentitySchemas(ctx, req)
33+
resourceIdentitySchemas, err := server.GetResourceIdentitySchemas(ctx, req)
4934

5035
if err != nil {
5136
return resp, fmt.Errorf("error calling GetResourceIdentitySchemas for %T: %w", server, err)

0 commit comments

Comments
 (0)