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
Leverage panics when running Terraform commands on layers were the config.tf or the locals.tf files contain malformed HCL.
It displays a message like:
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 59, in get_action
return states[state][token.type]
~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: '$END'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/bin/leverage", line 8, in <module>
sys.exit(leverage())
^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/_internals.py", line 50, in new_command
return command(ctx.obj.container, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/modules/terraform.py", line 95, in plan
invoke_for_all_commands(layers, _plan, args)
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/_internals.py", line 50, in new_command
return command(ctx.obj.container, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/modules/terraform.py", line 271, in invoke_for_all_commands
command(args=args)
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/_internals.py", line 50, in new_command
return command(ctx.obj.container, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/modules/terraform.py", line 325, in _plan
exit_code = tf.start_in_layer("plan", *tf.tf_default_args, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/container.py", line 605, in start_in_layer
return self.start(command, *arguments)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/container.py", line 598, in start
with AwsCredsEntryPoint(self, self.entrypoint):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/_utils.py", line 87, in __init__
auth_method = container.auth_method()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/container.py", line 511, in auth_method
refresh_layer_credentials(self)
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/modules/auth.py", line 86, in refresh_layer_credentials
tf_profile, raw_profiles = get_profiles(cli)
^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/leverage/modules/auth.py", line 69, in get_profiles
tf_config = hcl2.load(tf_file)
^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/hcl2/api.py", line 9, in load
return loads(file.read())
^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/hcl2/api.py", line 18, in loads
return hcl2.parse(text + "\n")
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/lark/lark.py", line 464, in parse
return self.parser.parse(text, start=start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/lark/parser_frontends.py", line 115, in parse
return self._parse(token_stream, start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/lark/parser_frontends.py", line 63, in _parse
return self.parser.parse(input, start, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 35, in parse
return self.parser.parse(*args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 111, in parse
_action, arg = get_action(token)
^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-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('$END', '') at line 32, column 1.
Expected one of:
* RBRACE
In this case a right curly brace was missing in a locals.tf file.
Expected Behavior
Leverage recognizes the scenario and shows a informative error message.
Steps to Reproduce
Steps to reproduce the behavior:
Go to a particular layer in a Ref Arch implementation
Delete a curly brace form either locals.tf or config.tf
Run a terraform command such as leverage tf init
See error
The text was updated successfully, but these errors were encountered:
Describe the Bug
Leverage panics when running Terraform commands on layers were the
config.tf
or thelocals.tf
files contain malformed HCL.It displays a message like:
In this case a right curly brace was missing in a
locals.tf
file.Expected Behavior
Leverage recognizes the scenario and shows a informative error message.
Steps to Reproduce
Steps to reproduce the behavior:
locals.tf
orconfig.tf
leverage tf init
The text was updated successfully, but these errors were encountered: