Skip to content

fix: Add support for attributes named "in". #164

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

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions hcl2/hcl2.lark
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ block : identifier (identifier | STRING_LIT)* new_line_or_comment? "{" body "}"
new_line_and_or_comma: new_line_or_comment | "," | "," new_line_or_comment
new_line_or_comment: ( /\n/ | /#.*\n/ | /\/\/.*\n/ )+

identifier : /[a-zA-Z_][a-zA-Z0-9_-]*/
identifier : /[a-zA-Z_][a-zA-Z0-9_-]*/ | IN
IN : "in"

?expression : expr_term | operation | conditional

Expand All @@ -27,7 +28,7 @@ expr_term : "(" new_line_or_comment? expression new_line_or_comment? ")"
| index_expr_term
| get_attr_expr_term
| identifier
| provider_function_call
| provider_function_call
| heredoc_template
| heredoc_template_trim
| attr_splat_expr_term
Expand Down
13 changes: 13 additions & 0 deletions test/helpers/terraform-config-json/resource_in_attribute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"resource": [
{
"custom_provider_resource": {
"resource_name": {
"name": "resource_name",
"attribute": "attribute_value",
"in": "attribute_value2"
}
}
}
]
}
5 changes: 5 additions & 0 deletions test/helpers/terraform-config/resource_in_attribute.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "custom_provider_resource" "resource_name" {
name = "resource_name"
attribute = "attribute_value"
in = "attribute_value2"
}
Loading