You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my_local = {
for k, v in local.map_a : k => v
if lookup(local.map_b[v.id], "enabled", false)
|| (
contains(local.map_c, v.id)
&& contains(local.map_d, v.id)
)
}
It returns the following error when I attempt to parse the file:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 590, in lex
yield lexer.next_token(lexer_state, parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 528, in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: No terminal matches '|' in the current parser context, at line 20 col 5
|| (
^
Expected one of:
* /<<(?P<heredoc>[a-zA-Z][a-zA-Z0-9._-]+)\n(?:.|\n)*?(?P=heredoc)/
* BANG
* /#.*\n/
* COLON
* RSQB
* /[a-zA-Z_][a-zA-Z0-9_-]*/
* LBRACE
* STRING_LIT
* RBRACE
* DECIMAL
* LSQB
* /\n/
* /<<-(?P<heredoc_trim>[a-zA-Z][a-zA-Z0-9._-]+)\n(?:.|\n)*?(?P=heredoc_trim)/
* MINUS
* /\/\/.*\n/
* LPAR
* COMMA
* RPAR
Previous tokens: Token('__ANON_0', '\n')
I can fix this by moving the entire local on to a single line, or adjusting it like this:
my_local = {
for k, v in local.map_a : k => v
if lookup(local.map_b[v.id], "enabled", false) || (
contains(local.map_c, v.id) && (
contains(local.map_d, v.id))
)
}
Seems like as long as I put || or && at the start or end of a line it produces this error.
The text was updated successfully, but these errors were encountered:
I have the following Terraform local:
It returns the following error when I attempt to parse the file:
I can fix this by moving the entire local on to a single line, or adjusting it like this:
Seems like as long as I put
||
or&&
at the start or end of a line it produces this error.The text was updated successfully, but these errors were encountered: