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
Previously I was using a json formatted back-end file. On Friday suddenly terraform plan started throwing errors about not expecting a Left brace. I updated the name of the file to exclude .json and changed the syntax to HCL and it worked.
I did test a plan and apply locally with the same json files and received no syntax errors.
Plan: 0 to add, 6 to change, 0 to destroy.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/lark/parsers/lalr_parser.py", line 59, in get_action
return states[state][token.type]
KeyError: 'LBRACE'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/terraform/hcl.py", line 16, in try_load
return hcl2.load(f)
File "/usr/local/lib/python3.9/dist-packages/hcl2/api.py", line 9, in load
returnloads(file.read())
File "/usr/local/lib/python3.9/dist-packages/hcl2/api.py", line 18, in loads
return hcl2.parse(text + "\n")
File "/usr/local/lib/python3.9/dist-packages/lark/lark.py", line 464, in parse
return self.parser.parse(text, start=start)
File "/usr/local/lib/python3.9/dist-packages/lark/parser_frontends.py", line 115, in parse
return self._parse(token_stream, start)
File "/usr/local/lib/python3.9/dist-packages/lark/parser_frontends.py", line 63, in _parse
return self.parser.parse(input, start, *args)
File "/usr/local/lib/python3.9/dist-packages/lark/parsers/lalr_parser.py", line 35, in parse
return self.parser.parse(*args)
File "/usr/local/lib/python3.9/dist-packages/lark/parsers/lalr_parser.py", line 88, in parse
action, arg = get_action(token)
File "/usr/local/lib/python3.9/dist-packages/lark/parsers/lalr_parser.py", line 66, in get_action
raise UnexpectedToken(token, expected, state=state, puppet=puppet)
lark.exceptions.UnexpectedToken: Unexpected token Token('LBRACE', '***') at line 1, column 1.
Expected one of:
* __ANON_3
* __ANON_0
* __ANON_1
* __ANON_2
*$END
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/terraform/hcl.py", line 61, in<module>
try_load(Path(sys.argv[1]))
File "/usr/local/lib/python3.9/dist-packages/terraform/hcl.py", line 18, in try_load
debug(e)
File "/usr/local/lib/python3.9/dist-packages/github_actions/debug.py", line 9, in debug
forlineinmsg.splitlines():
AttributeError: 'UnexpectedToken' object has no attribute 'splitlines'
Failed to load backend config file infrastructure/.s3.tfbackend.json
The text was updated successfully, but these errors were encountered:
Going by the docs, Terraform supports JSON syntax with .json suffix, e.g., .tf.json and .tfvars.json. This is useful for feeding in programmatically-generated JSON output prepared by other software.
For our "backend_config_file" example, that can look like:
I thought this was my problem, but actually my solution was to just not specify the backend config file. That works in the case of .tf.json files, where a backend file would start with
Problem description
Previously I was using a json formatted back-end file. On Friday suddenly
terraform plan
started throwing errors about not expecting a Left brace. I updated the name of the file to exclude.json
and changed the syntax to HCL and it worked.I did test a
plan
andapply
locally with the samejson
files and received no syntax errors.Terraform version
1.3.6
Backend
s3
Workflow YAML
Workflow log
The text was updated successfully, but these errors were encountered: