question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transform Modules to Constructs

See original GitHub issue

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

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:open
  • Created 3 years ago
  • Reactions:10
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jsteinichcommented, Aug 21, 2020

@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.

0reactions
benkeilcommented, Sep 3, 2022

Sounds good. I think about to write an extension for kotest

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found