Skip to content

Commit 6ea6e73

Browse files
authored
framework6provider: set identity in StateMover (#366)
* framework6provider: set identity in StateMover * tidy
1 parent 48a0c2f commit 6ea6e73

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

internal/framework5provider/move_state_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (r MoveStateResource) MoveState(ctx context.Context) []resource.StateMover
121121
}
122122

123123
resp.Diagnostics.Append(resp.TargetState.SetAttribute(ctx, path.Root("moved_random_string"), oldState.Result)...)
124+
resp.Diagnostics.Append(resp.TargetIdentity.SetAttribute(ctx, path.Root("id"), oldState.Result)...)
124125
case "registry.terraform.io/hashicorp/framework": // Corner provider (testing identity moves)
125126
if req.SourceTypeName != "framework_identity" {
126127
resp.Diagnostics.AddError(

internal/framework5provider/provider.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package framework
55

66
import (
77
"context"
8-
"fmt"
98

109
"github.com/hashicorp/terraform-plugin-framework/datasource"
1110
"github.com/hashicorp/terraform-plugin-framework/ephemeral"
@@ -149,7 +148,6 @@ func (p *testProvider) EphemeralResources(ctx context.Context) []func() ephemera
149148
}
150149

151150
func (p *testProvider) ListResources(_ context.Context) []func() list.ListResource {
152-
fmt.Println("ListResources called")
153151
return []func() list.ListResource{
154152
NewListResourceAsListResource,
155153
}

internal/framework6provider/move_state_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (r MoveStateResource) MoveState(ctx context.Context) []resource.StateMover
121121
}
122122

123123
resp.Diagnostics.Append(resp.TargetState.SetAttribute(ctx, path.Root("moved_random_string"), oldState.Result)...)
124+
resp.Diagnostics.Append(resp.TargetIdentity.SetAttribute(ctx, path.Root("id"), oldState.Result)...)
124125
case "registry.terraform.io/hashicorp/framework": // Corner provider (testing identity moves)
125126
if req.SourceTypeName != "framework_identity" {
126127
resp.Diagnostics.AddError(

0 commit comments

Comments
 (0)