Loading...
Loading...
### Terraform Version ```shell all ``` ### Terraform Configuration Files resource "volcenginecc_mongodb_allowlist" "tf2" { allow_list_name = "tf2_allowlist_test" allow_list_type = "IPv4" project_name = "default" allow_list_desc = "" allow_list_category = "Default" allow_list = [ "0.0.0.0/0", "127.0.0.1", "192.168.1.0/24", "192.168.1.0/25", "1.1.1.2", "1.1.1.3", "1.1.1.4", "1.1.1.5", "1.1.1.6", "1.1.1.7" ] } update allow_list ### Debug Output nothing ### Expected Behavior update allow_list_ip_num to lastest value ### Actual Behavior { "version": 4, "terraform_version": "1.12.1", "serial": 17, "lineage": "ebefe02e-df35-21f1-7967-6b3468f78efa", "outputs": {}, "resources": [ { "mode": "managed", "type": "volcenginecc_mongodb_allowlist", "name": "tf2", "provider": "provider[\"registry.terraform.io/volcengine/volcenginecc\"]", "instances": [ { "schema_version": 1, "attributes": { "allow_list": [ "0.0.0.0/0", "1.1.1.2", "1.1.1.3", "1.1.1.4", "1.1.1.5", "1.1.1.6", "1.1.1.7", "127.0.0.1", "192.168.1.0/24", "192.168.1.0/25" ], "allow_list_category": "Default", "allow_list_desc": "", "allow_list_id": "acl-c972e7b4ce4941a1a8d58b8e57b283e5", **"allow_list_ip_num": 10,** "allow_list_name": "tf2_allowlist_test", "allow_list_type": "IPv4", "associated_instance_num": 0, "associated_instances": null, "id": "acl-c972e7b4ce4941a1a8d58b8e57b283e5", "project_name": "default" }, "sensitive_attributes": [], "identity_schema_version": 0 } ] } ], "check_results": null } ### Steps to Reproduce terraform apply ### Additional Context I have a resource schema that defines two attributes: allow_list and allow_list_ip_num. Among them, allow_list_ip_num is a read-only field. The expected behavior is: When I add or remove an IP in allow_list, the backend service returns the updated value of allow_list_ip_num (the actual number of IPs in the allow list). Terraform should detect this change from the Read API and refresh the state accordingly, without requiring any manual updates to allow_list_ip_num. However, the actual behavior is: After I add an IP into allow_list, the backend API correctly returns the new allow_list_ip_num value. Terraform state does not update this read-only field automatically. If I try to manually change allow_list_ip_num to match the latest value, Terraform fails with the following error: `produced an unexpected new value: .allow_list_ip_num: was cty.NumberIntVal(9), but now cty.NumberIntVal(10). ` This looks like Terraform is treating the read-only field as if it should not change, even though the provider’s Read/Refresh logic returns the new value from the backend. Could you please help confirm whether this is a bug in how read-only attributes are handled, or if there is a recommended pattern for modeling this kind of “computed count” field so that it can be updated correctly in state when the underlying list changes? ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.