-
Notifications
You must be signed in to change notification settings - Fork 232
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
Add support for 64-bit integers and/or "big" integers? #92
Comments
Hi @ewbankkit! The improved configuration language interpreter we're currently working on integrating (based on what is currently codenamed HCL2 removes the int vs. float distinction and instead makes all numbers arbitrary-precision floats, which are internally represented as As you noted, there are a lot of touchpoints to make this change across the whole of Terraform, and so our initial work is focused on making it work within Terraform Core, the interpolation language, functions, etc but will not include any changes to the We plan to work on this It will take some time for us to reach the point where this change is fully realized, so in the short term we've usually resorted to using |
I've labelled this with "schema-helper" because the Core type system work is already in progress and so I'd like to use this issue to represent the subsequent work to introduce new numeric types to |
@apparentlymart Thanks for the thorough explanation. |
Using a This "hcl2shim" code is there to support the opt-in experimental version of the new language system that we're planning to release to gather feedback and do more testing before we switch wholesale to the new implementation, so this code is making a "best effort" attempt to map the new system onto the expectations of the old system so that the two can coexist for a few releases. This code will be removed once the new system is first-class, but indeed there will need to be some similar code in (Note that the shim is intentionally allowing loss of precision for integers that require more than 53 bits on a 32-bit system, since that compatibility shim's goal is to make sure we can represent all possible values that HCL and |
Hey @apparentlymart - thanks for conveying the workaround of using Also, conversely, once a resource argument has been made as a In my limited testing, I do see this being done by the framework, but was not sure if this was an intended behavior that the users of the framework can depend on. Thanks! |
Yes, today the provider SDK is doing that automatic conversion. From 0.12 onwards it will be Terraform Core that does the conversion, since it will then know the expected types of all arguments and the configuration language interpreter itself will do type checking and automatic conversions where possible. From the perspective of the provider SDK API there should be no discernible difference, though... just the same work being done in a different place. |
I believe #662 resolved this. |
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. |
Motivated by support for Amazon side ASNs in hashicorp/terraform-provider-aws#1888 and hashicorp/terraform-provider-aws#2861 but more widely applicable.
Terraform uses the golang
int
type for values ofTypeInt
and the underlying width of the integer depends on the platform the binary is built for, so integer values greater than 2147483647 cannot safely be represented usingTypeInt
.Adding support for
TypeInt64
(golangint64
) and/orTypeBigInt
(golangbig.Int
) would touch more than just the schema code, affecting HIL, the interpolation functions etc.The text was updated successfully, but these errors were encountered: