-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point precision differences after migrating from SDKv2 #815
Comments
Hi @jharley 👋 Thank you for reporting this and sorry you are running into this unexpected situation here. The team is looking into this and we will try to provide an update soon. |
Can you also confirm your Terraform CLI version? From the debug logs I see:
But if you could confirm that, that would be great. It would also be helpful to try it out on the latest version (1.5.4 as of this writing), if it does happen to be that older version, just to confirm whether this is a bug that has resolved in Terraform itself. |
The test suite is using 1.0.11 For Reasons™ via Confirmed the same behaviour with 1.5.4 |
Terraform's number handling is arbitrary precision, meaning that the framework itself must preserve that precision when roundtripping a number value. The fix here will likely be a patch release of the terraform-plugin-framework Go module where the internals of the Float64 value storage will be switched from the |
Hi there @jharley 👋🏻 , we've released a fix for this bug in One behavior to be aware of is that Plugin SDKv2 has legacy data consistency handling which would allow the following config to be stored in state as resource “examplecloud_resource” “test” {
float64_attribute = 1 - 0.99
} When you migrate a resource like this to Plugin Framework, the prior value of Providers are allowed to store config exactly or store prior state exactly, so either of these situations are valid 👍🏻 |
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. |
I recently migrated the
honeycombio_trigger
resource from the Plugin SDKv2 to the Plugin Framework and received a bug report that the way floating point numbers are being handled is differently.I think this is not so much a 'bug' -- I can see increased precision as a feature! -- but I am looking for guidance on how to handle this case. A custom
planmodifier
?Module version
Relevant provider source code
https://github.com/honeycombio/terraform-provider-honeycombio/blob/main/internal/provider/trigger_resource.go#L132-L153
Terraform Configuration Files
Debug Output
https://gist.github.com/jharley/90ec9c38c70858c0e1bdcaaea0707c05
Expected Behavior
As with the SDKv2-based resource, it parses
threshold[0].value
as 0.01Actual Behavior
Steps to Reproduce
terraform plan
Test to reproduce is on this branch: honeycombio/terraform-provider-honeycombio@467e603
References
Reported bug: honeycombio/terraform-provider-honeycombio#335
The text was updated successfully, but these errors were encountered: