Access entire state during "ModifyPlan" execution

Is there a way to access the entire state file from within the ModifyPlan function (ResourceWithModifyPlan interface)?
I understand the ModifyPlanRequest has a ‘State’ attribute, but that is only the state for the current resource and not the whole state file.

Hi @mapi :wave:

I don’t believe this is possible. As @maxb mentions in With the terraform-plugin-framework how can i access the full state which terraform is managing for all providers? - #2 by maxb, this is by design.

Can you provide a little more context as to you use-case? What is it that you’re trying to achieve by having access to the entire state file?

Hi Bendbennett!
Thanks for the speedy reply, I already feared that this functionality was not available (by design).

We want to allow update of an attribute of a resource only if that has not been referenced by another resource in the state file

We could handle this on the backend api as well (we should do this regardless if we have access to the statefile or not),
But if we could already catch this during the plan phase, it would be a better user experience.

+1, we would like to see the state of other resources to display warnings to the user. Right now we have to do additional network calls in ModifyPlan to accomplish this, but it seems wasteful when the information we need is right there in the state.