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

HCL - allow for expression on LHS in objectelem #4831

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

greg-at-moderne
Copy link
Contributor

@greg-at-moderne greg-at-moderne commented Jan 2, 2025

What's changed?

Adding the support for expressions in object elements in HCL. These are typically used for provider aliases in Terraform configuration files, e.g.

                providers = {
                  aws = aws
                  aws.dns = aws
                }

What's your motivation?

To fix parsing errors of valid Terraform code.

@greg-at-moderne greg-at-moderne marked this pull request as ready for review January 2, 2025 13:10
@timtebeek timtebeek added bug Something isn't working parser-hcl labels Jan 2, 2025
Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see, thanks! I've not looked at any of the internal classes beyond the HclParserVisitor, assuming those are all generated. If I should have a closer look there feel free to call out anything with a self-review. If not, then we're ready to merge. 🚀

@greg-at-moderne
Copy link
Contributor Author

Yep. All changes in rewrite-hcl/src/main/java/org/openrewrite/hcl/internal/grammar are generated code based on the .g4 lexer/parser.

@greg-at-moderne greg-at-moderne merged commit 1b1f1fe into main Jan 2, 2025
4 checks passed
@greg-at-moderne greg-at-moderne deleted the goledzki-hcl-expression-in-objectelem branch January 2, 2025 14:55
@greg-at-moderne greg-at-moderne changed the title Hcl - allow for expression on LHS in objectelem HCL - allow for expression on LHS in objectelem Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-hcl
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants