Closed apparentlymart closed 4 years ago
Unfortunately we didn't have time to implement this before shipping Terraform with HCL 2 and so the current behavior is now a compatibility constraint. We may reconsider this for a hypothetical future major version of HCL 2, but will not be able to make the change I described above in the near future.
Those coming from C-based languages may bring an expectation that zero-prefixed number literals are to be interpreted as octal. HCL 2 does not do that, and currently seems to just interpret them as decimal numbers after stripping the leading zero, which can lead to confusing, hard-to-explain results.
As a compromise then, we should detect when a numeric literal has leading zeros and produce an error about it which includes a specific note about octal numbers. Something like: