Skip to content

Commit 6def5ff

Browse files
committed
Add toproto updates for identity to MoveResourceState RPC
1 parent 354564c commit 6def5ff

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

internal/fromproto5/moveresourcestate.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ func MoveResourceStateRequest(ctx context.Context, proto5 *tfprotov5.MoveResourc
3838
}
3939

4040
fw := &fwserver.MoveResourceStateRequest{
41-
SourceProviderAddress: proto5.SourceProviderAddress,
42-
SourceRawState: (*tfprotov6.RawState)(proto5.SourceState),
43-
SourceSchemaVersion: proto5.SourceSchemaVersion,
44-
SourceTypeName: proto5.SourceTypeName,
45-
TargetResource: resource,
46-
TargetResourceSchema: resourceSchema,
47-
TargetTypeName: proto5.TargetTypeName,
48-
SourceIdentity: (*tfprotov6.RawState)(proto5.SourceIdentity),
41+
SourceProviderAddress: proto5.SourceProviderAddress,
42+
SourceRawState: (*tfprotov6.RawState)(proto5.SourceState),
43+
SourceSchemaVersion: proto5.SourceSchemaVersion,
44+
SourceTypeName: proto5.SourceTypeName,
45+
TargetResource: resource,
46+
TargetResourceSchema: resourceSchema,
47+
TargetTypeName: proto5.TargetTypeName,
48+
SourceIdentity: (*tfprotov6.RawState)(proto5.SourceIdentity),
49+
SourceIdentitySchemaVersion: proto5.SourceIdentitySchemaVersion,
4950
}
5051

5152
sourcePrivate, sourcePrivateDiags := privatestate.NewData(ctx, proto5.SourcePrivate)

internal/fromproto6/moveresourcestate.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package fromproto6
55

66
import (
77
"context"
8-
98
"github.com/hashicorp/terraform-plugin-framework/diag"
109
"github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
1110
"github.com/hashicorp/terraform-plugin-framework/internal/fwserver"
@@ -37,13 +36,15 @@ func MoveResourceStateRequest(ctx context.Context, proto6 *tfprotov6.MoveResourc
3736
}
3837

3938
fw := &fwserver.MoveResourceStateRequest{
40-
SourceProviderAddress: proto6.SourceProviderAddress,
41-
SourceRawState: proto6.SourceState,
42-
SourceSchemaVersion: proto6.SourceSchemaVersion,
43-
SourceTypeName: proto6.SourceTypeName,
44-
TargetResource: resource,
45-
TargetResourceSchema: resourceSchema,
46-
TargetTypeName: proto6.TargetTypeName,
39+
SourceProviderAddress: proto6.SourceProviderAddress,
40+
SourceRawState: proto6.SourceState,
41+
SourceSchemaVersion: proto6.SourceSchemaVersion,
42+
SourceTypeName: proto6.SourceTypeName,
43+
TargetResource: resource,
44+
TargetResourceSchema: resourceSchema,
45+
TargetTypeName: proto6.TargetTypeName,
46+
SourceIdentity: proto6.SourceIdentity,
47+
SourceIdentitySchemaVersion: proto6.SourceIdentitySchemaVersion,
4748
}
4849

4950
sourcePrivate, sourcePrivateDiags := privatestate.NewData(ctx, proto6.SourcePrivate)

internal/toproto5/moveresourcestate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func MoveResourceStateResponse(ctx context.Context, fw *fwserver.MoveResourceSta
2727
proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...)
2828
proto5.TargetPrivate = targetPrivate
2929

30+
targetIdentity, diags := ResourceIdentity(ctx, fw.TargetIdentity)
31+
32+
proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...)
33+
proto5.TargetIdentity = targetIdentity
34+
3035
targetState, diags := State(ctx, fw.TargetState)
3136

3237
proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...)

internal/toproto6/moveresourcestate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func MoveResourceStateResponse(ctx context.Context, fw *fwserver.MoveResourceSta
2727
proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...)
2828
proto6.TargetPrivate = targetPrivate
2929

30+
targetIdentity, diags := ResourceIdentity(ctx, fw.TargetIdentity)
31+
32+
proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...)
33+
proto6.TargetIdentity = targetIdentity
34+
3035
targetState, diags := State(ctx, fw.TargetState)
3136

3237
proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...)

0 commit comments

Comments
 (0)