Skip to content

Commit ba1098a

Browse files
authored
add missing capability MoveResourceState (#1038)
* add missing capability MoveResourceState ---------
1 parent 7076cca commit ba1098a

9 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: BUG FIXES
2+
body: 'providerserver: Fixed bug that prevented `moved` operation support between
3+
resource types for framework-only providers.'
4+
time: 2024-09-17T16:37:16.161402-04:00
5+
custom:
6+
Issue: "1039"

internal/proto5server/server_getmetadata_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func TestServerGetMetadata(t *testing.T) {
6565
Resources: []tfprotov5.ResourceMetadata{},
6666
ServerCapabilities: &tfprotov5.ServerCapabilities{
6767
GetProviderSchemaOptional: true,
68+
MoveResourceState: true,
6869
PlanDestroy: true,
6970
},
7071
},
@@ -110,6 +111,7 @@ func TestServerGetMetadata(t *testing.T) {
110111
Resources: []tfprotov5.ResourceMetadata{},
111112
ServerCapabilities: &tfprotov5.ServerCapabilities{
112113
GetProviderSchemaOptional: true,
114+
MoveResourceState: true,
113115
PlanDestroy: true,
114116
},
115117
},
@@ -147,6 +149,7 @@ func TestServerGetMetadata(t *testing.T) {
147149
Resources: []tfprotov5.ResourceMetadata{},
148150
ServerCapabilities: &tfprotov5.ServerCapabilities{
149151
GetProviderSchemaOptional: true,
152+
MoveResourceState: true,
150153
PlanDestroy: true,
151154
},
152155
},
@@ -190,6 +193,7 @@ func TestServerGetMetadata(t *testing.T) {
190193
Resources: []tfprotov5.ResourceMetadata{},
191194
ServerCapabilities: &tfprotov5.ServerCapabilities{
192195
GetProviderSchemaOptional: true,
196+
MoveResourceState: true,
193197
PlanDestroy: true,
194198
},
195199
},
@@ -235,6 +239,7 @@ func TestServerGetMetadata(t *testing.T) {
235239
Resources: []tfprotov5.ResourceMetadata{},
236240
ServerCapabilities: &tfprotov5.ServerCapabilities{
237241
GetProviderSchemaOptional: true,
242+
MoveResourceState: true,
238243
PlanDestroy: true,
239244
},
240245
},
@@ -272,6 +277,7 @@ func TestServerGetMetadata(t *testing.T) {
272277
Resources: []tfprotov5.ResourceMetadata{},
273278
ServerCapabilities: &tfprotov5.ServerCapabilities{
274279
GetProviderSchemaOptional: true,
280+
MoveResourceState: true,
275281
PlanDestroy: true,
276282
},
277283
},
@@ -315,6 +321,7 @@ func TestServerGetMetadata(t *testing.T) {
315321
},
316322
ServerCapabilities: &tfprotov5.ServerCapabilities{
317323
GetProviderSchemaOptional: true,
324+
MoveResourceState: true,
318325
PlanDestroy: true,
319326
},
320327
},
@@ -360,6 +367,7 @@ func TestServerGetMetadata(t *testing.T) {
360367
Resources: []tfprotov5.ResourceMetadata{},
361368
ServerCapabilities: &tfprotov5.ServerCapabilities{
362369
GetProviderSchemaOptional: true,
370+
MoveResourceState: true,
363371
PlanDestroy: true,
364372
},
365373
},
@@ -397,6 +405,7 @@ func TestServerGetMetadata(t *testing.T) {
397405
Resources: []tfprotov5.ResourceMetadata{},
398406
ServerCapabilities: &tfprotov5.ServerCapabilities{
399407
GetProviderSchemaOptional: true,
408+
MoveResourceState: true,
400409
PlanDestroy: true,
401410
},
402411
},

internal/proto5server/server_getproviderschema_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func TestServerGetProviderSchema(t *testing.T) {
110110
ResourceSchemas: map[string]*tfprotov5.Schema{},
111111
ServerCapabilities: &tfprotov5.ServerCapabilities{
112112
GetProviderSchemaOptional: true,
113+
MoveResourceState: true,
113114
PlanDestroy: true,
114115
},
115116
},
@@ -176,6 +177,7 @@ func TestServerGetProviderSchema(t *testing.T) {
176177
ResourceSchemas: map[string]*tfprotov5.Schema{},
177178
ServerCapabilities: &tfprotov5.ServerCapabilities{
178179
GetProviderSchemaOptional: true,
180+
MoveResourceState: true,
179181
PlanDestroy: true,
180182
},
181183
},
@@ -216,6 +218,7 @@ func TestServerGetProviderSchema(t *testing.T) {
216218
ResourceSchemas: map[string]*tfprotov5.Schema{},
217219
ServerCapabilities: &tfprotov5.ServerCapabilities{
218220
GetProviderSchemaOptional: true,
221+
MoveResourceState: true,
219222
PlanDestroy: true,
220223
},
221224
},
@@ -278,6 +281,7 @@ func TestServerGetProviderSchema(t *testing.T) {
278281
ResourceSchemas: map[string]*tfprotov5.Schema{},
279282
ServerCapabilities: &tfprotov5.ServerCapabilities{
280283
GetProviderSchemaOptional: true,
284+
MoveResourceState: true,
281285
PlanDestroy: true,
282286
},
283287
},
@@ -336,6 +340,7 @@ func TestServerGetProviderSchema(t *testing.T) {
336340
ResourceSchemas: map[string]*tfprotov5.Schema{},
337341
ServerCapabilities: &tfprotov5.ServerCapabilities{
338342
GetProviderSchemaOptional: true,
343+
MoveResourceState: true,
339344
PlanDestroy: true,
340345
},
341346
},
@@ -376,6 +381,7 @@ func TestServerGetProviderSchema(t *testing.T) {
376381
ResourceSchemas: map[string]*tfprotov5.Schema{},
377382
ServerCapabilities: &tfprotov5.ServerCapabilities{
378383
GetProviderSchemaOptional: true,
384+
MoveResourceState: true,
379385
PlanDestroy: true,
380386
},
381387
},
@@ -414,6 +420,7 @@ func TestServerGetProviderSchema(t *testing.T) {
414420
ResourceSchemas: map[string]*tfprotov5.Schema{},
415421
ServerCapabilities: &tfprotov5.ServerCapabilities{
416422
GetProviderSchemaOptional: true,
423+
MoveResourceState: true,
417424
PlanDestroy: true,
418425
},
419426
},
@@ -456,6 +463,7 @@ func TestServerGetProviderSchema(t *testing.T) {
456463
ResourceSchemas: map[string]*tfprotov5.Schema{},
457464
ServerCapabilities: &tfprotov5.ServerCapabilities{
458465
GetProviderSchemaOptional: true,
466+
MoveResourceState: true,
459467
PlanDestroy: true,
460468
},
461469
},
@@ -536,6 +544,7 @@ func TestServerGetProviderSchema(t *testing.T) {
536544
},
537545
ServerCapabilities: &tfprotov5.ServerCapabilities{
538546
GetProviderSchemaOptional: true,
547+
MoveResourceState: true,
539548
PlanDestroy: true,
540549
},
541550
},
@@ -602,6 +611,7 @@ func TestServerGetProviderSchema(t *testing.T) {
602611
ResourceSchemas: map[string]*tfprotov5.Schema{},
603612
ServerCapabilities: &tfprotov5.ServerCapabilities{
604613
GetProviderSchemaOptional: true,
614+
MoveResourceState: true,
605615
PlanDestroy: true,
606616
},
607617
},
@@ -642,6 +652,7 @@ func TestServerGetProviderSchema(t *testing.T) {
642652
ResourceSchemas: map[string]*tfprotov5.Schema{},
643653
ServerCapabilities: &tfprotov5.ServerCapabilities{
644654
GetProviderSchemaOptional: true,
655+
MoveResourceState: true,
645656
PlanDestroy: true,
646657
},
647658
},

internal/proto6server/server_getmetadata_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func TestServerGetMetadata(t *testing.T) {
6565
Resources: []tfprotov6.ResourceMetadata{},
6666
ServerCapabilities: &tfprotov6.ServerCapabilities{
6767
GetProviderSchemaOptional: true,
68+
MoveResourceState: true,
6869
PlanDestroy: true,
6970
},
7071
},
@@ -110,6 +111,7 @@ func TestServerGetMetadata(t *testing.T) {
110111
Resources: []tfprotov6.ResourceMetadata{},
111112
ServerCapabilities: &tfprotov6.ServerCapabilities{
112113
GetProviderSchemaOptional: true,
114+
MoveResourceState: true,
113115
PlanDestroy: true,
114116
},
115117
},
@@ -147,6 +149,7 @@ func TestServerGetMetadata(t *testing.T) {
147149
Resources: []tfprotov6.ResourceMetadata{},
148150
ServerCapabilities: &tfprotov6.ServerCapabilities{
149151
GetProviderSchemaOptional: true,
152+
MoveResourceState: true,
150153
PlanDestroy: true,
151154
},
152155
},
@@ -190,6 +193,7 @@ func TestServerGetMetadata(t *testing.T) {
190193
Resources: []tfprotov6.ResourceMetadata{},
191194
ServerCapabilities: &tfprotov6.ServerCapabilities{
192195
GetProviderSchemaOptional: true,
196+
MoveResourceState: true,
193197
PlanDestroy: true,
194198
},
195199
},
@@ -235,6 +239,7 @@ func TestServerGetMetadata(t *testing.T) {
235239
Resources: []tfprotov6.ResourceMetadata{},
236240
ServerCapabilities: &tfprotov6.ServerCapabilities{
237241
GetProviderSchemaOptional: true,
242+
MoveResourceState: true,
238243
PlanDestroy: true,
239244
},
240245
},
@@ -272,6 +277,7 @@ func TestServerGetMetadata(t *testing.T) {
272277
Resources: []tfprotov6.ResourceMetadata{},
273278
ServerCapabilities: &tfprotov6.ServerCapabilities{
274279
GetProviderSchemaOptional: true,
280+
MoveResourceState: true,
275281
PlanDestroy: true,
276282
},
277283
},
@@ -315,6 +321,7 @@ func TestServerGetMetadata(t *testing.T) {
315321
},
316322
ServerCapabilities: &tfprotov6.ServerCapabilities{
317323
GetProviderSchemaOptional: true,
324+
MoveResourceState: true,
318325
PlanDestroy: true,
319326
},
320327
},
@@ -360,6 +367,7 @@ func TestServerGetMetadata(t *testing.T) {
360367
Resources: []tfprotov6.ResourceMetadata{},
361368
ServerCapabilities: &tfprotov6.ServerCapabilities{
362369
GetProviderSchemaOptional: true,
370+
MoveResourceState: true,
363371
PlanDestroy: true,
364372
},
365373
},
@@ -397,6 +405,7 @@ func TestServerGetMetadata(t *testing.T) {
397405
Resources: []tfprotov6.ResourceMetadata{},
398406
ServerCapabilities: &tfprotov6.ServerCapabilities{
399407
GetProviderSchemaOptional: true,
408+
MoveResourceState: true,
400409
PlanDestroy: true,
401410
},
402411
},

internal/proto6server/server_getproviderschema_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func TestServerGetProviderSchema(t *testing.T) {
110110
ResourceSchemas: map[string]*tfprotov6.Schema{},
111111
ServerCapabilities: &tfprotov6.ServerCapabilities{
112112
GetProviderSchemaOptional: true,
113+
MoveResourceState: true,
113114
PlanDestroy: true,
114115
},
115116
},
@@ -176,6 +177,7 @@ func TestServerGetProviderSchema(t *testing.T) {
176177
ResourceSchemas: map[string]*tfprotov6.Schema{},
177178
ServerCapabilities: &tfprotov6.ServerCapabilities{
178179
GetProviderSchemaOptional: true,
180+
MoveResourceState: true,
179181
PlanDestroy: true,
180182
},
181183
},
@@ -216,6 +218,7 @@ func TestServerGetProviderSchema(t *testing.T) {
216218
ResourceSchemas: map[string]*tfprotov6.Schema{},
217219
ServerCapabilities: &tfprotov6.ServerCapabilities{
218220
GetProviderSchemaOptional: true,
221+
MoveResourceState: true,
219222
PlanDestroy: true,
220223
},
221224
},
@@ -278,6 +281,7 @@ func TestServerGetProviderSchema(t *testing.T) {
278281
ResourceSchemas: map[string]*tfprotov6.Schema{},
279282
ServerCapabilities: &tfprotov6.ServerCapabilities{
280283
GetProviderSchemaOptional: true,
284+
MoveResourceState: true,
281285
PlanDestroy: true,
282286
},
283287
},
@@ -336,6 +340,7 @@ func TestServerGetProviderSchema(t *testing.T) {
336340
ResourceSchemas: map[string]*tfprotov6.Schema{},
337341
ServerCapabilities: &tfprotov6.ServerCapabilities{
338342
GetProviderSchemaOptional: true,
343+
MoveResourceState: true,
339344
PlanDestroy: true,
340345
},
341346
},
@@ -376,6 +381,7 @@ func TestServerGetProviderSchema(t *testing.T) {
376381
ResourceSchemas: map[string]*tfprotov6.Schema{},
377382
ServerCapabilities: &tfprotov6.ServerCapabilities{
378383
GetProviderSchemaOptional: true,
384+
MoveResourceState: true,
379385
PlanDestroy: true,
380386
},
381387
},
@@ -414,6 +420,7 @@ func TestServerGetProviderSchema(t *testing.T) {
414420
ResourceSchemas: map[string]*tfprotov6.Schema{},
415421
ServerCapabilities: &tfprotov6.ServerCapabilities{
416422
GetProviderSchemaOptional: true,
423+
MoveResourceState: true,
417424
PlanDestroy: true,
418425
},
419426
},
@@ -456,6 +463,7 @@ func TestServerGetProviderSchema(t *testing.T) {
456463
ResourceSchemas: map[string]*tfprotov6.Schema{},
457464
ServerCapabilities: &tfprotov6.ServerCapabilities{
458465
GetProviderSchemaOptional: true,
466+
MoveResourceState: true,
459467
PlanDestroy: true,
460468
},
461469
},
@@ -536,6 +544,7 @@ func TestServerGetProviderSchema(t *testing.T) {
536544
},
537545
ServerCapabilities: &tfprotov6.ServerCapabilities{
538546
GetProviderSchemaOptional: true,
547+
MoveResourceState: true,
539548
PlanDestroy: true,
540549
},
541550
},
@@ -602,6 +611,7 @@ func TestServerGetProviderSchema(t *testing.T) {
602611
ResourceSchemas: map[string]*tfprotov6.Schema{},
603612
ServerCapabilities: &tfprotov6.ServerCapabilities{
604613
GetProviderSchemaOptional: true,
614+
MoveResourceState: true,
605615
PlanDestroy: true,
606616
},
607617
},
@@ -642,6 +652,7 @@ func TestServerGetProviderSchema(t *testing.T) {
642652
ResourceSchemas: map[string]*tfprotov6.Schema{},
643653
ServerCapabilities: &tfprotov6.ServerCapabilities{
644654
GetProviderSchemaOptional: true,
655+
MoveResourceState: true,
645656
PlanDestroy: true,
646657
},
647658
},

internal/toproto5/server_capabilities.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func ServerCapabilities(ctx context.Context, fw *fwserver.ServerCapabilities) *t
1919

2020
return &tfprotov5.ServerCapabilities{
2121
GetProviderSchemaOptional: fw.GetProviderSchemaOptional,
22+
MoveResourceState: fw.MoveResourceState,
2223
PlanDestroy: fw.PlanDestroy,
2324
}
2425
}

internal/toproto5/server_capabilities_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ func TestServerCapabilities(t *testing.T) {
3232
GetProviderSchemaOptional: true,
3333
},
3434
},
35+
"MoveResourceState": {
36+
fw: &fwserver.ServerCapabilities{
37+
MoveResourceState: true,
38+
},
39+
expected: &tfprotov5.ServerCapabilities{
40+
MoveResourceState: true,
41+
},
42+
},
3543
"PlanDestroy": {
3644
fw: &fwserver.ServerCapabilities{
3745
PlanDestroy: true,

internal/toproto6/server_capabilities.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func ServerCapabilities(ctx context.Context, fw *fwserver.ServerCapabilities) *t
1919

2020
return &tfprotov6.ServerCapabilities{
2121
GetProviderSchemaOptional: fw.GetProviderSchemaOptional,
22+
MoveResourceState: fw.MoveResourceState,
2223
PlanDestroy: fw.PlanDestroy,
2324
}
2425
}

internal/toproto6/server_capabilities_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ func TestServerCapabilities(t *testing.T) {
3232
GetProviderSchemaOptional: true,
3333
},
3434
},
35+
"MoveResourceState": {
36+
fw: &fwserver.ServerCapabilities{
37+
MoveResourceState: true,
38+
},
39+
expected: &tfprotov6.ServerCapabilities{
40+
MoveResourceState: true,
41+
},
42+
},
3543
"PlanDestroy": {
3644
fw: &fwserver.ServerCapabilities{
3745
PlanDestroy: true,

0 commit comments

Comments
 (0)