Locally change tfstate value in the update function

Hi,

I have written a provider that manages account objects with a role parameter (string) and a target (list of strings). The code set the list to an empty one as long as the role is equal to “Administrator”.

On an update, changing the role from user to admin clears the list on the API call. But then the list still remains in the tfstate. If I apply again, terraform sees the change remotely and updates the tfstate.

My update function returns the read function. I tried to do something like `d.Set(“target”, ) before the return call, but it does nothing.

Any lead on that case ?

Thank you for your help
Regards
J