Skip to content
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

Import from Terraform doesn't pass config to TerraformHclModule correctly #860

Closed
jsteinich opened this issue Jul 29, 2021 · 4 comments · Fixed by #929 or #1120
Closed

Import from Terraform doesn't pass config to TerraformHclModule correctly #860

jsteinich opened this issue Jul 29, 2021 · 4 comments · Fixed by #929 or #1120
Labels
bug Something isn't working confirmed independently reproduced by an engineer on the team feature/convert priority/important-soon High priority, to be worked on as part of our current release or the following one.

Comments

@jsteinich
Copy link
Collaborator

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

Latest build from main

Affected Resource(s)

Modules not from registry

Expected Behavior

configuration passed to modules passed in variables map

Actual Behavior

Configuration values are passed to directly in configuration object

Steps to Reproduce

  1. Create Terraform file that references a non-registry module that requires passing configuration
  2. Run cdktf init from terraform
  3. Run cdktf synth
@jsteinich jsteinich added bug Something isn't working new Un-triaged issue labels Jul 29, 2021
@DanielMSchmidt DanielMSchmidt added feature/convert confirmed independently reproduced by an engineer on the team priority/important-soon High priority, to be worked on as part of our current release or the following one. and removed new Un-triaged issue labels Jul 29, 2021
@DanielMSchmidt
Copy link
Contributor

I spiked into converting modules as well just to get a feeling for how hard it would be. It's quite some effort I am afraid since they can be used recursively and we would need to get the type information about the interface. It's not undoable, but there is quite some handling that is different from the normal conversion (inputs, outputs, etc.). My POC branch is feat-recursive-module-conversion. We should fix this differently, by changing the current generation to fit the API of TerraformHclModule

@jsteinich
Copy link
Collaborator Author

I'll take a look at your branch when I get a chance.
We do already support code generation for modules so we may want to solve some of those issues regardless.

@DanielMSchmidt
Copy link
Contributor

The code generation for modules can be found here. We already check if it's a local / registry module, so this part is all that needs change:

One problem is that the asExpression helper translates the value to typescript (camelcase and reference replacement in one), we probably should split that up so that valueToTs(x) is replaceDependencies(camelCaseRecursively(x)) and we can only use replaceDependencies(x) in this case (if I understand TerraformHclModules correctly)

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working confirmed independently reproduced by an engineer on the team feature/convert priority/important-soon High priority, to be worked on as part of our current release or the following one.
Projects
None yet
2 participants