-
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
Incorrect module source path generated for local modules #946
Comments
Seems like a duplicate of #664 |
maybe was fixed for typescript, but currently I'm getting the same error using python.
I'm getting the same error and I have the same configuration of @JonCubed on python, the module binding generation is not working on this case, at least it should copy the hcl module into the .terraform/modules path as works for the modules that come from the terraform registry. I'm attaching the modules.json generated on .terraform/modules path:
Please accept the fix that @JonCubed created. |
Apologizes. I wasn't trying to imply that it was fixed; just that there is another issue that is also tracking the same problem.
I don't think I'm completely following what is going wrong. Module binding generation is controlled by adding modules to |
This is the cdktf.json
The The issue exists in the source tag (cdk.tf.json), that the cdktf is setting when you run the This the tree of the cdktf.out folder
This is the snippet code of the cdk.tf.json generated.
I see that you currently are working in a PR to fix it, but you should have under the radar the solution for the asset approach + TerraformHCLModule. I created a PR for that https://github.com/hashicorp/terraform-cdk/pull/961/files |
Thanks @javier-caylent. I'm hopeful that we can get this working better for the next release. |
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. |
I believe that the source path that is generated in cdk.tf.json is incorrect for local modules, it doesn't take into account the output folder structure being
stack/<stack name>
and it needs to back up one more folder. I believe the issue is on L34terraform-cdk/packages/cdktf/lib/terraform-module.ts
Lines 33 to 35 in 337acff
It should be
This is how I reproduce it:
cdktf init --template="python-pip" --local
modules/module1
modules/module1/main.tf
your file structure should look like this
cdktf get
cdktf diff
you should get errors similar to
The text was updated successfully, but these errors were encountered: