hashicorp / terraform-plugin-framework

A next-generation framework for building Terraform providers.
https://developer.hashicorp.com/terraform/plugin/framework
Mozilla Public License 2.0
298 stars 92 forks source link

Consider skip comparison for a specified attribute between plan and state after the update #944

Closed shiyuhang0 closed 6 months ago

shiyuhang0 commented 7 months ago

Module version

github.com/hashicorp/terraform-plugin-framework v1.6.1

Use-cases

image

According to the official doc. Any difference between state and plan after the update will throw Provider produced inconsistent result error.

In my case, there is an attribute status which is computed and marked as UseStateForUnknown. When users want to update the resource. The status will be changed from available to modifying automatically. As a result, plan is still available but the state is set to modifying. Thus, Provider produced inconsistent result occurs.

 Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to tidbcloud_cluster.dedicated_tier_cluster, provider "provider[\"registry.terraform.io/tidbcloud/tidbcloud\"]" produced an unexpected new value:
│ .status.cluster_status: was cty.StringVal("AVAILABLE"), but now cty.StringVal("MODIFYING").

I wonder if there is a way to avoid comparison for a specified attribute(status in my case) after the update? or is there any way to avoid the error?

Attempted Solutions

Proposal

References

bendbennett commented 7 months ago

Hi @shiyuhang0 👋

Sorry you ran into trouble here.

As this seems to be a question around framework and provider behaviour rather than reporting of a bug, or requesting an enhancement, can I ask that you post this question in our Discuss forum? The forum is an excellent place to raise questions of this sort as there is a community with a wide range of experience that can offer help. When posting on the Discuss forum, please include configuration and provider code that permits a reproduction of the issue you are encountering along with a description of what you are trying to achieve. Thanks.

bendbennett commented 6 months ago

Closing: Issue has been raised on Discuss.

github-actions[bot] commented 5 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.