We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pyhcl is not able to handle parsing of hcl files containing nested parenthesis.
pyhcl: v0.4.4 Python: 3.7.5
$ cat test.tf locals { map = { r1 = "21.0.0.0/16" r2 = "22.4.0.0/16" } sg = { "test" = [ "r1", "r2" ] } } resource "aws_security_group" "test" { name = "testshubham" vpc_id = "vpc-xxxxxxxxx" dynamic "ingress" { for_each = local.sg.test content { from_port = 80 to_port = 80 protocol = "tcp" cidr_blocks = split(",", lookup(local.map, ingress.value, ingress.value)) } } } $ python Python 3.7.5 (default, Jan 1 2020, 15:46:16) [Clang 7.0.0 (clang-700.0.72)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import hcl >>> with open('test.tf', 'r') as fp: ... obj = hcl.load(fp) ... Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/Users/therasec/.pyenv/versions/terrascan/lib/python3.7/site-packages/hcl/api.py", line 62, in load return loads(fp.read(), export_comments=export_comments) File "/Users/therasec/.pyenv/versions/terrascan/lib/python3.7/site-packages/hcl/api.py", line 81, in loads return HclParser().parse(s, export_comments=export_comments) File "/Users/therasec/.pyenv/versions/terrascan/lib/python3.7/site-packages/hcl/parser.py", line 643, in parse s, lexer=Lexer(export_comments=export_comments), debug=DEBUG File "/Users/therasec/.pyenv/versions/terrascan/lib/python3.7/site-packages/hcl/ply/yacc.py", line 503, in parse tok = self.errorfunc(errtoken) File "/Users/therasec/.pyenv/versions/terrascan/lib/python3.7/site-packages/hcl/parser.py", line 634, in p_error raise ValueError(msg) ValueError: Line 26, column 397: unexpected LEFTPAREN; expected ASTERISK_PERIOD, RIGHTBRACKET, COMMA, RIGHTPAREN, ADD, MINUS, MULTIPLY, DIVIDE
The text was updated successfully, but these errors were encountered:
That appears to be HCL2 which is not supported by pyhcl. See the readme for alternative parsers.
Sorry, something went wrong.
No branches or pull requests
Description
pyhcl is not able to handle parsing of hcl files containing nested parenthesis.
How to reproduce the issue
pyhcl: v0.4.4
Python: 3.7.5
The text was updated successfully, but these errors were encountered: