Skip to content

Commit 627a49b

Browse files
committed
remove config from renew
1 parent 55f2ba6 commit 627a49b

15 files changed

+30
-255
lines changed

ephemeral/renew.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ type RenewRequest struct {
1818
// resource following the Open operation.
1919
State tfsdk.EphemeralState
2020

21-
// Config is the configuration the user supplied for the ephemeral
22-
// resource.
23-
Config tfsdk.Config
24-
2521
// Private is provider-defined ephemeral resource private state data
2622
// which was previously provided by the latest Open or Renew operation.
2723
// Any existing data is copied to RenewResponse.Private to prevent

go.mod

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

77
require (
88
github.com/google/go-cmp v0.6.0
9-
github.com/hashicorp/terraform-plugin-go v0.24.0
9+
github.com/hashicorp/terraform-plugin-go v0.24.1-0.20240924154457-cd3b6654adf0
1010
github.com/hashicorp/terraform-plugin-log v0.9.0
1111
)
1212

@@ -25,10 +25,10 @@ require (
2525
github.com/oklog/run v1.0.0 // indirect
2626
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
2727
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
28-
golang.org/x/net v0.26.0 // indirect
29-
golang.org/x/sys v0.21.0 // indirect
30-
golang.org/x/text v0.16.0 // indirect
31-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
32-
google.golang.org/grpc v1.66.2 // indirect
28+
golang.org/x/net v0.28.0 // indirect
29+
golang.org/x/sys v0.24.0 // indirect
30+
golang.org/x/text v0.17.0 // indirect
31+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
32+
google.golang.org/grpc v1.67.0 // indirect
3333
google.golang.org/protobuf v1.34.2 // indirect
3434
)

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOs
1515
github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0=
1616
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
1717
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
18-
github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U=
19-
github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg=
18+
github.com/hashicorp/terraform-plugin-go v0.24.1-0.20240924154457-cd3b6654adf0 h1:WgAlLzllo3v6BeZccPW5IETHgRylr/9y37X314C+09I=
19+
github.com/hashicorp/terraform-plugin-go v0.24.1-0.20240924154457-cd3b6654adf0/go.mod h1:zoSM9LyEFI4iVkDeKXgwBHV0uTuIIXydtK1fy9J4wBA=
2020
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
2121
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
2222
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
@@ -46,21 +46,21 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU
4646
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
4747
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
4848
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
49-
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
50-
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
49+
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
50+
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
5151
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5252
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5353
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5454
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5555
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
56-
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
57-
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
58-
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
59-
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
60-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU=
61-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
62-
google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo=
63-
google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
56+
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
57+
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
58+
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
59+
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
60+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
61+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
62+
google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw=
63+
google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
6464
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
6565
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
6666
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

internal/fromproto5/renewephemeralresource.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ func RenewEphemeralResourceRequest(ctx context.Context, proto5 *tfprotov5.RenewE
4242
EphemeralResourceSchema: ephemeralResourceSchema,
4343
}
4444

45-
config, configDiags := Config(ctx, proto5.Config, ephemeralResourceSchema)
46-
47-
diags.Append(configDiags...)
48-
49-
fw.Config = config
50-
5145
state, stateDiags := EphemeralState(ctx, proto5.State, ephemeralResourceSchema)
5246

5347
diags.Append(stateDiags...)

internal/fromproto5/renewephemeralresource_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,34 +79,6 @@ func TestRenewEphemeralResourceRequest(t *testing.T) {
7979
),
8080
},
8181
},
82-
"config-missing-schema": {
83-
input: &tfprotov5.RenewEphemeralResourceRequest{
84-
Config: &testProto5DynamicValue,
85-
},
86-
expected: nil,
87-
expectedDiagnostics: diag.Diagnostics{
88-
diag.NewErrorDiagnostic(
89-
"Missing EphemeralResource Schema",
90-
"An unexpected error was encountered when handling the request. "+
91-
"This is always an issue in terraform-plugin-framework used to implement the provider and should be reported to the provider developers.\n\n"+
92-
"Please report this to the provider developer:\n\n"+
93-
"Missing schema.",
94-
),
95-
},
96-
},
97-
"config": {
98-
input: &tfprotov5.RenewEphemeralResourceRequest{
99-
Config: &testProto5DynamicValue,
100-
},
101-
ephemeralResourceSchema: testFwSchema,
102-
expected: &fwserver.RenewEphemeralResourceRequest{
103-
Config: &tfsdk.Config{
104-
Raw: testProto5Value,
105-
Schema: testFwSchema,
106-
},
107-
EphemeralResourceSchema: testFwSchema,
108-
},
109-
},
11082
"private": {
11183
input: &tfprotov5.RenewEphemeralResourceRequest{
11284
Private: privatestate.MustMarshalToJson(map[string][]byte{

internal/fromproto6/renewephemeralresource.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ func RenewEphemeralResourceRequest(ctx context.Context, proto6 *tfprotov6.RenewE
4242
EphemeralResourceSchema: ephemeralResourceSchema,
4343
}
4444

45-
config, configDiags := Config(ctx, proto6.Config, ephemeralResourceSchema)
46-
47-
diags.Append(configDiags...)
48-
49-
fw.Config = config
50-
5145
state, stateDiags := EphemeralState(ctx, proto6.State, ephemeralResourceSchema)
5246

5347
diags.Append(stateDiags...)

internal/fromproto6/renewephemeralresource_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,34 +79,6 @@ func TestRenewEphemeralResourceRequest(t *testing.T) {
7979
),
8080
},
8181
},
82-
"config-missing-schema": {
83-
input: &tfprotov6.RenewEphemeralResourceRequest{
84-
Config: &testProto6DynamicValue,
85-
},
86-
expected: nil,
87-
expectedDiagnostics: diag.Diagnostics{
88-
diag.NewErrorDiagnostic(
89-
"Missing EphemeralResource Schema",
90-
"An unexpected error was encountered when handling the request. "+
91-
"This is always an issue in terraform-plugin-framework used to implement the provider and should be reported to the provider developers.\n\n"+
92-
"Please report this to the provider developer:\n\n"+
93-
"Missing schema.",
94-
),
95-
},
96-
},
97-
"config": {
98-
input: &tfprotov6.RenewEphemeralResourceRequest{
99-
Config: &testProto6DynamicValue,
100-
},
101-
ephemeralResourceSchema: testFwSchema,
102-
expected: &fwserver.RenewEphemeralResourceRequest{
103-
Config: &tfsdk.Config{
104-
Raw: testProto6Value,
105-
Schema: testFwSchema,
106-
},
107-
EphemeralResourceSchema: testFwSchema,
108-
},
109-
},
11082
"private": {
11183
input: &tfprotov6.RenewEphemeralResourceRequest{
11284
Private: privatestate.MustMarshalToJson(map[string][]byte{

internal/fwserver/server_renewephemeralresource.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
// RenewEphemeralResourceRequest is the framework server request for the
1919
// RenewEphemeralResource RPC.
2020
type RenewEphemeralResourceRequest struct {
21-
Config *tfsdk.Config
2221
State *tfsdk.EphemeralState
2322
Private *privatestate.Data
2423
EphemeralResourceSchema fwschema.Schema
@@ -92,9 +91,6 @@ func (s *Server) RenewEphemeralResource(ctx context.Context, req *RenewEphemeral
9291
}
9392

9493
renewReq := ephemeral.RenewRequest{
95-
Config: tfsdk.Config{
96-
Schema: req.EphemeralResourceSchema,
97-
},
9894
State: tfsdk.EphemeralState{
9995
Schema: req.EphemeralResourceSchema,
10096
Raw: req.State.Raw.Copy(),
@@ -105,10 +101,6 @@ func (s *Server) RenewEphemeralResource(ctx context.Context, req *RenewEphemeral
105101
Private: renewReq.Private,
106102
}
107103

108-
if req.Config != nil {
109-
renewReq.Config = *req.Config
110-
}
111-
112104
logging.FrameworkTrace(ctx, "Calling provider defined EphemeralResource Renew")
113105
resourceWithRenew.Renew(ctx, renewReq, &renewResp)
114106
logging.FrameworkTrace(ctx, "Called provider defined EphemeralResource Renew")

internal/fwserver/server_renewephemeralresource_test.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
3434
},
3535
}
3636

37-
testConfigValue := tftypes.NewValue(testType, map[string]tftypes.Value{
38-
"test_computed": tftypes.NewValue(tftypes.String, nil),
39-
"test_required": tftypes.NewValue(tftypes.String, "test-config-value"),
40-
})
41-
4237
testStateValue := tftypes.NewValue(testType, map[string]tftypes.Value{
4338
"test_computed": tftypes.NewValue(tftypes.String, "test-state-value"),
4439
"test_required": tftypes.NewValue(tftypes.String, "test-config-value"),
@@ -55,11 +50,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
5550
},
5651
}
5752

58-
testConfig := &tfsdk.Config{
59-
Raw: testConfigValue,
60-
Schema: testSchema,
61-
}
62-
6353
testState := &tfsdk.EphemeralState{
6454
Raw: testStateValue,
6555
Schema: testSchema,
@@ -102,39 +92,11 @@ func TestServerRenewEphemeralResource(t *testing.T) {
10292
},
10393
expectedResponse: &fwserver.RenewEphemeralResourceResponse{},
10494
},
105-
"request-config": {
106-
server: &fwserver.Server{
107-
Provider: &testprovider.Provider{},
108-
},
109-
request: &fwserver.RenewEphemeralResourceRequest{
110-
Config: testConfig,
111-
State: testState,
112-
EphemeralResourceSchema: testSchema,
113-
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
114-
RenewMethod: func(ctx context.Context, req ephemeral.RenewRequest, resp *ephemeral.RenewResponse) {
115-
var config struct {
116-
TestComputed types.String `tfsdk:"test_computed"`
117-
TestRequired types.String `tfsdk:"test_required"`
118-
}
119-
120-
resp.Diagnostics.Append(req.Config.Get(ctx, &config)...)
121-
122-
if config.TestRequired.ValueString() != "test-config-value" {
123-
resp.Diagnostics.AddError("unexpected req.Config value: %s", config.TestRequired.ValueString())
124-
}
125-
},
126-
},
127-
},
128-
expectedResponse: &fwserver.RenewEphemeralResourceResponse{
129-
Private: testEmptyPrivate,
130-
},
131-
},
13295
"request-state-missing": {
13396
server: &fwserver.Server{
13497
Provider: &testprovider.Provider{},
13598
},
13699
request: &fwserver.RenewEphemeralResourceRequest{
137-
Config: testConfig,
138100
EphemeralResourceSchema: testSchema,
139101
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
140102
RenewMethod: func(ctx context.Context, req ephemeral.RenewRequest, resp *ephemeral.RenewResponse) {},
@@ -155,7 +117,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
155117
Provider: &testprovider.Provider{},
156118
},
157119
request: &fwserver.RenewEphemeralResourceRequest{
158-
Config: testConfig,
159120
State: testState,
160121
EphemeralResourceSchema: testSchema,
161122
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
@@ -186,7 +147,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
186147
Provider: &testprovider.Provider{},
187148
},
188149
request: &fwserver.RenewEphemeralResourceRequest{
189-
Config: testConfig,
190150
State: testState,
191151
EphemeralResourceSchema: testSchema,
192152
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
@@ -214,7 +174,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
214174
Provider: &testprovider.Provider{},
215175
},
216176
request: &fwserver.RenewEphemeralResourceRequest{
217-
Config: testConfig,
218177
State: testState,
219178
EphemeralResourceSchema: testSchema,
220179
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
@@ -242,7 +201,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
242201
Provider: &testprovider.Provider{},
243202
},
244203
request: &fwserver.RenewEphemeralResourceRequest{
245-
Config: testConfig,
246204
State: testState,
247205
EphemeralResourceSchema: testSchema,
248206
// Doesn't implement Renew interface
@@ -265,7 +223,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
265223
Provider: &testprovider.Provider{},
266224
},
267225
request: &fwserver.RenewEphemeralResourceRequest{
268-
Config: testConfig,
269226
State: testState,
270227
EphemeralResourceSchema: testSchema,
271228
EphemeralResource: &testprovider.EphemeralResourceWithConfigureAndRenew{
@@ -304,7 +261,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
304261
Provider: &testprovider.Provider{},
305262
},
306263
request: &fwserver.RenewEphemeralResourceRequest{
307-
Config: testConfig,
308264
State: testState,
309265
EphemeralResourceSchema: testSchema,
310266
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
@@ -321,7 +277,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
321277
Provider: &testprovider.Provider{},
322278
},
323279
request: &fwserver.RenewEphemeralResourceRequest{
324-
Config: testConfig,
325280
State: testState,
326281
EphemeralResourceSchema: testSchema,
327282
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
@@ -350,7 +305,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
350305
Provider: &testprovider.Provider{},
351306
},
352307
request: &fwserver.RenewEphemeralResourceRequest{
353-
Config: testConfig,
354308
State: testState,
355309
EphemeralResourceSchema: testSchema,
356310
EphemeralResource: &testprovider.EphemeralResourceWithRenew{
@@ -369,7 +323,6 @@ func TestServerRenewEphemeralResource(t *testing.T) {
369323
Provider: &testprovider.Provider{},
370324
},
371325
request: &fwserver.RenewEphemeralResourceRequest{
372-
Config: testConfig,
373326
State: testState,
374327
EphemeralResourceSchema: testSchema,
375328
EphemeralResource: &testprovider.EphemeralResourceWithRenew{

internal/proto5server/server_getmetadata_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ func TestServerGetMetadata(t *testing.T) {
198198
Resources: []tfprotov5.ResourceMetadata{},
199199
ServerCapabilities: &tfprotov5.ServerCapabilities{
200200
GetProviderSchemaOptional: true,
201+
MoveResourceState: true,
201202
PlanDestroy: true,
202203
},
203204
},
@@ -244,6 +245,7 @@ func TestServerGetMetadata(t *testing.T) {
244245
Resources: []tfprotov5.ResourceMetadata{},
245246
ServerCapabilities: &tfprotov5.ServerCapabilities{
246247
GetProviderSchemaOptional: true,
248+
MoveResourceState: true,
247249
PlanDestroy: true,
248250
},
249251
},
@@ -282,6 +284,7 @@ func TestServerGetMetadata(t *testing.T) {
282284
Resources: []tfprotov5.ResourceMetadata{},
283285
ServerCapabilities: &tfprotov5.ServerCapabilities{
284286
GetProviderSchemaOptional: true,
287+
MoveResourceState: true,
285288
PlanDestroy: true,
286289
},
287290
},

0 commit comments

Comments
 (0)