Transform Modules to Constructs
See original GitHub issueCommunity 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
Description
Right now, the support of Terraform Modules is quite limited. Besides from only being available via the Terraform Registry, we parse the metadata only. From that metadata, the type information is derived and a Construct class for that Module interface is created. When synthesized, it ends up being treated as a classical Terraform module where Terraform will fetch the actual module source code.
There are a few drawbacks to this from my point of view:
- Special handing is required when parsing output (e.g. see #113)
- Resources in the module are hidden from the
constructs
tree- No dynamic changes to these resources (e.g. thinking of tagging aspects)
- No way of accessing this in unit tests
- Supportive tooling will likely be limited (e.g. #189)
Proposal
A Terraform module could be fully transformed into a Construct and enable the use-cases described above. A prerequisite for this to happen would be:
- A
hcl2cdktf
tool - Full coverage of the HCL syntax in
cdktf
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Distributing and Consuming Constructs | CDK for Terraform
Translate custom constructs to multiple languages. Use the projen project to quickly package and distribute constructs to public or private registries.
Read more >@babel/plugin-transform-modules-commonjs | Yarn - Yarn
Fast, reliable, and secure dependency management.
Read more >babel/plugin-transform-modules-commonjs
This plugin transforms ECMAScript modules to CommonJS. Note that only the syntax of import/export statements ( import "./mod.js" ) and import expressions ...
Read more >How to Create CDK Constructs - Matthew Bonig
First is creating a JSII module that is our construct, and the second is getting it built and published. In this case I'm...
Read more >Haiku API reference
Transforms a function using Haiku modules into a pair of pure functions. ... Constructs a Bias module that supports broadcasting. Parameters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@digitalsanctum I think what you’re after is covered by #16. This is going farther and converting a terraform module into a construct tree. Writing in code would look very similar to using a terraform module in hcl, but the generated terraform json would actually just contain all of the resources that would have been in the module.
Sounds good. I think about to write an extension for kotest