Equivalent to d.SetId("") in the new plugin framework?

:wave:t2: I’m creating a new provider, using the new TF plugin framework, and its logic is based off an existing version of the provider using the old plugin SDK.

In the old provider there is a part of the Read() flow where the response from the API contains a deleted_at field and so if the resource returns that field the provider calls d.SetId("") to ultimately cause the resource to be deleted from state.

Is there an equivalent for this using the new TF plugin framework?


I guess the approach here would be if the response from the API includes deleted_at then I should either not set anything in *resource.ReadResponse or remove the item from it if it’s already in there.

So for anyone interested I tried to do the following…

resp.Diagnostics.Append(resp.State.Set(ctx, nil)...)

And I actually got a useful error message…

cannot set nil as entire state; 
    to remove a resource from state, 
        call State.RemoveResource, instead

So this means doing…