-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
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
cdktf unable to parse modules without newlines at EOF #595
Comments
I'm having some trouble reproducing this issue. @celliott are you able to provide a simple module which reproduces this? Also what version of terraform are you using? |
I have a thought as to what is causing this. Likely same issue as xchapter7x/clarity#23 (reference) since file contents are also concatenated here. |
@jsteinich I am using |
@jsteinich I updated repo with an example and added a cdktf.json. I am using
|
Thanks for the update. I believe that I've found the root cause and have a PR open to address. |
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
cdktf & Language Versions
using
typescript@4.2.3
andcdktf 0.2.0
Affected Resource(s)
cdktf importing of custom modules
Debug Output
i'm using the new module improvements from #584 to source modules locally and from github. It is works as expected unless a module's variables and/or outputs tf files do not have a newline at EOF. cdktf fails to parse those modules. Add a newline to EOF for suspect files and then cdktf will successful parse and import the module.
error gist
example terraformModules
Expected Behavior
I would expect to be able to import a module that works without error when using tarraform directly. It's easy to fix but it wasn't clear at first what the issue was. If there is no fix, then better documentation and error messaging would help.
Actual Behavior
A source a custom tf module with the improved module importing and any module that doesn;t have new lines at EOF fail to parse. I have tested with both local or github sourced modules and as expected, the behavior is the same.
Steps to Reproduce
Source a module from local or github using
terraformModules
incdktf.sjon
. Make sure that the file containing eitheroutputs
orvariables
does NOT have a newline at EOF. Runcdktf get
and the module with fail to import. Add a newline to the end of the file(s), reimport and it will work as expected.The text was updated successfully, but these errors were encountered: