Closed michaelnwani closed 2 months ago
Hey, this is a problem in how you use TerraformModule, it's a class intended for generated module bindings or references to HCL modules not an equivalent to a TerraformModule in HCL. For that you would generally want to use Construct. I created a PR that adds a validation to the module so that this kind of usage is prevented in the future.
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.
Expected Behavior
Given a stack that declares a Terraform module:
And the module contains a scoped resource:
I expected to see the resource inside of the module in the synthesized hcl, because it was specified in a different scope, like this for example:
Actual Behavior
The resource that was created in the terraform module isn't actually in the module:
^ Also, under the
./assets/__cdktf_module_asset_26CE565C/AED96664F96F513147DECF4060B0C6AE
directory, there's no generated terraform; just themodules/moduleA/main.ts
file that was copied over.Steps to Reproduce
cdktf init --template="typescript" --providers "random"
cdktf.json
cdktf synth --hcl
Versions
npm
: 9.6.7node
: v18.17.1cdktf.json
:tsconfig.json
:Providers
Community Note