Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/framework5provider/move_state_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func (r MoveStateResource) Read(ctx context.Context, req resource.ReadRequest, r
return
}

// Unlike normal resources, this resource can't produce it's identity during read, but it's the same value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I understand this comment but it does feel a little like a pronoun game

// as the state value, so we can just use that to prevent any pass-through errors for versions of Terraform
// that don't support identity.
if req.Identity.Raw.IsNull() {
resp.Diagnostics.Append(resp.Identity.SetAttribute(ctx, path.Root("id"), data.MovedRandomString)...)
}

resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
}

Expand Down
7 changes: 7 additions & 0 deletions internal/framework6provider/move_state_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func (r MoveStateResource) Read(ctx context.Context, req resource.ReadRequest, r
return
}

// Unlike normal resources, this resource can't produce it's identity during read, but it's the same value
// as the state value, so we can just use that to prevent any pass-through errors for versions of Terraform
// that don't support identity.
if req.Identity.Raw.IsNull() {
resp.Diagnostics.Append(resp.Identity.SetAttribute(ctx, path.Root("id"), data.MovedRandomString)...)
}

resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
}

Expand Down
Loading