Skip to content
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 underscore to HCL function identifier regex #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

keeakita
Copy link

As titled. While I realize that this is similar to #185 which was closed, I believe that just adding the underscore will keep the regex idiomatic while covering common, real-world cases.

The HCL spec here:
https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#identifiers

contains the following paragraph:

The dash character - is additionally allowed in identifiers, even though
that is not part of the unicode ID_Continue definition. This is to allow
attribute names and block type names to contain dashes, although underscores
as word separators are considered the idiomatic usage.

I believe this sufficiently implies that the use of _ as an idiomatic word-separator character in identifiers.

Additionally, we can see real-world adoption of this practice in projects like Terragrunt, which use the underscore as a word separator for built-in functions: https://terragrunt.gruntwork.io/docs/reference/built-in-functions/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant