rewrite
rewrite copied to clipboard
HCL: Support provider scoped functions
As of version 1.8 Terraform supports provider scoped functions as in this example:
terraform {
required_providers {
test = {
source = "hashicorp/test"
}
}
}
locals {
result = provider::test::count_e("cheese")
}
The OpenRewrite HCL parser currently fails to parse this:
Caused by: org.openrewrite.hcl.HclParsingException: Syntax error in file.tf at line 9:18 mismatched input ':' expecting {'}', Identifier, '[', '?', '.'}.
at org.openrewrite.hcl.HclParser$ForwardingErrorListener.syntaxError(HclParser.java:105)
... 26 more
Caused by: org.antlr.v4.runtime.InputMismatchException
at org.antlr.v4.runtime.DefaultErrorStrategy.recoverInline(DefaultErrorStrategy.java:485)
at org.antlr.v4.runtime.Parser.match(Parser.java:208)
at org.openrewrite.hcl.internal.grammar.HCLParser.blockExpr(HCLParser.java:1104)
... 21 more
@jetbrains-junie Propose a plan.
Here's Claude instead of Junie:
- https://github.com/openrewrite/rewrite/pull/6194