Skip to content

Commit aad1420

Browse files
Update internal/fwserver/server_moveresourcestate_test.go
Co-authored-by: Austin Valle <[email protected]>
1 parent 7388eaf commit aad1420

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/fwserver/server_moveresourcestate_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,13 @@ func TestServerMoveResourceState(t *testing.T) {
941941
return []resource.StateMover{
942942
{
943943
StateMover: func(_ context.Context, req resource.MoveStateRequest, resp *resource.MoveStateResponse) {
944-
// Try to set TargetIdentity even though req.IdentitySchema is nil
945-
resp.Diagnostics.Append(resp.TargetIdentity.SetAttribute(ctx, path.Root("test_id"), "should-not-be-set")...)
944+
// This resource doesn't indicate identity support (via a schema), so this should raise a diagnostic.
945+
resp.TargetIdentity = &tfsdk.ResourceIdentity{
946+
Raw: tftypes.NewValue(testIdentitySchema.Type().TerraformType(ctx), map[string]tftypes.Value{
947+
"test_id": tftypes.NewValue(tftypes.String, "should-not-be-set"),
948+
}),
949+
Schema: testIdentitySchema,
950+
}
946951

947952
// Prevent missing implementation error, the values do not matter except for response assertion
948953
resp.Diagnostics.Append(resp.TargetState.SetAttribute(ctx, path.Root("id"), "test-id-value")...)

0 commit comments

Comments
 (0)