You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 is able to generate working tf json for a module that uses type list variable source from another module's output
Actual Behavior
See gist for more detail
When I use a custom module that sources a list value from another module's output, tsc fails to compile with a type error. I see that custom sourced modules output types are always strings b/c they are references and not actual values.
The custom module wrapper generated by cdktf typed the input as string[]; which matches the module
The value sourced from the other module is a returned as a reference "${module.vpc.private_subnets_ids}". It is a string; not the actual value or string[]
Alternatively, if I change the ts to pass an array, then it uses ["${module.vpc.private_subnets_ids}"]. tsc is happy but TF correctly reads that as a nested array; which causes the error.
Steps to Reproduce
See gist for more detail
Add two sourced custom modules to cdktf.json
One must include an output with an array for a value
The other must use that value as an input typed list(string)
Create a basic cdktf definition with both modules. One using the list output as an input
$ cdktf get to generate the module wrappers
$ tsc <- where I see error 1
Important Factoids
Our modules are private or I would share a working example. If this bug is too confusing, then push back and I will create an example
I haven't tested yet, but I am planning on using a data source lookup to get the vpc values to pass to the rds module to route around this issue
The text was updated successfully, but these errors were encountered:
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.
Community Note
cdktf & Language Versions
using
typescript@4.2.3
andcdktf 0.2.0
Affected Resource(s)
cdktf importing of custom modules
Debug Output
https://gist.github.com/celliott/8fc7c7387ca2542ea7d50eebfe9d33c7
Expected Behavior
cdktf is able to generate working tf json for a module that uses type list variable source from another module's output
Actual Behavior
See gist for more detail
When I use a custom module that sources a list value from another module's output, tsc fails to compile with a type error. I see that custom sourced modules output types are always strings b/c they are references and not actual values.
string[]
; which matches the module"${module.vpc.private_subnets_ids}"
. It is a string; not the actual value or string[]["${module.vpc.private_subnets_ids}"]
. tsc is happy but TF correctly reads that as a nested array; which causes the error.Steps to Reproduce
See gist for more detail
cdktf.json
list(string)
$ cdktf get
to generate the module wrappers$ tsc
<- where I see error 1Important Factoids
The text was updated successfully, but these errors were encountered: