Skip to content

Commit

Permalink
add missing capability MoveResourceState (#1038)
Browse files Browse the repository at this point in the history
* add missing capability MoveResourceState

---------
  • Loading branch information
grongor authored Sep 17, 2024
1 parent 7076cca commit ba1098a
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/BUG FIXES-20240917-163716.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: BUG FIXES
body: 'providerserver: Fixed bug that prevented `moved` operation support between
resource types for framework-only providers.'
time: 2024-09-17T16:37:16.161402-04:00
custom:
Issue: "1039"
9 changes: 9 additions & 0 deletions internal/proto5server/server_getmetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -110,6 +111,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -147,6 +149,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -190,6 +193,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -235,6 +239,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -272,6 +277,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -315,6 +321,7 @@ func TestServerGetMetadata(t *testing.T) {
},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -360,6 +367,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -397,6 +405,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov5.ResourceMetadata{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down
11 changes: 11 additions & 0 deletions internal/proto5server/server_getproviderschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -176,6 +177,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -216,6 +218,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -278,6 +281,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -336,6 +340,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -376,6 +381,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -414,6 +420,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -456,6 +463,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -536,6 +544,7 @@ func TestServerGetProviderSchema(t *testing.T) {
},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -602,6 +611,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -642,6 +652,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov5.Schema{},
ServerCapabilities: &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down
9 changes: 9 additions & 0 deletions internal/proto6server/server_getmetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -110,6 +111,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -147,6 +149,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -190,6 +193,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -235,6 +239,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -272,6 +277,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -315,6 +321,7 @@ func TestServerGetMetadata(t *testing.T) {
},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -360,6 +367,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -397,6 +405,7 @@ func TestServerGetMetadata(t *testing.T) {
Resources: []tfprotov6.ResourceMetadata{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down
11 changes: 11 additions & 0 deletions internal/proto6server/server_getproviderschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -176,6 +177,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -216,6 +218,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -278,6 +281,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -336,6 +340,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -376,6 +381,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -414,6 +420,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -456,6 +463,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -536,6 +544,7 @@ func TestServerGetProviderSchema(t *testing.T) {
},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -602,6 +611,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down Expand Up @@ -642,6 +652,7 @@ func TestServerGetProviderSchema(t *testing.T) {
ResourceSchemas: map[string]*tfprotov6.Schema{},
ServerCapabilities: &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: true,
MoveResourceState: true,
PlanDestroy: true,
},
},
Expand Down
1 change: 1 addition & 0 deletions internal/toproto5/server_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func ServerCapabilities(ctx context.Context, fw *fwserver.ServerCapabilities) *t

return &tfprotov5.ServerCapabilities{
GetProviderSchemaOptional: fw.GetProviderSchemaOptional,
MoveResourceState: fw.MoveResourceState,
PlanDestroy: fw.PlanDestroy,
}
}
8 changes: 8 additions & 0 deletions internal/toproto5/server_capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func TestServerCapabilities(t *testing.T) {
GetProviderSchemaOptional: true,
},
},
"MoveResourceState": {
fw: &fwserver.ServerCapabilities{
MoveResourceState: true,
},
expected: &tfprotov5.ServerCapabilities{
MoveResourceState: true,
},
},
"PlanDestroy": {
fw: &fwserver.ServerCapabilities{
PlanDestroy: true,
Expand Down
1 change: 1 addition & 0 deletions internal/toproto6/server_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func ServerCapabilities(ctx context.Context, fw *fwserver.ServerCapabilities) *t

return &tfprotov6.ServerCapabilities{
GetProviderSchemaOptional: fw.GetProviderSchemaOptional,
MoveResourceState: fw.MoveResourceState,
PlanDestroy: fw.PlanDestroy,
}
}
8 changes: 8 additions & 0 deletions internal/toproto6/server_capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func TestServerCapabilities(t *testing.T) {
GetProviderSchemaOptional: true,
},
},
"MoveResourceState": {
fw: &fwserver.ServerCapabilities{
MoveResourceState: true,
},
expected: &tfprotov6.ServerCapabilities{
MoveResourceState: true,
},
},
"PlanDestroy": {
fw: &fwserver.ServerCapabilities{
PlanDestroy: true,
Expand Down

0 comments on commit ba1098a

Please sign in to comment.