Can the stack outputs be disconnected from `nodejs...
# typescript
g
Can the stack outputs be disconnected from
nodejs
module exports? To me, it looks like an unfortunate design choice. Because these have nothing to do with each other.
l
In my experience, the only place to export Pulumi outputs from is the top-level program, and the only place to export module exports from is from modules. These two don't overlap (at least in my code). Is there a way to parameterize a module? I'm not aware of one, so as I understand it, there's no way to safely create exportable resources in a module: the risk of having the same module be imported twice, creating resource conflicts, is too high. Resources need to be created in parameterizable code, like class constructors or functions. You can export the classes or functions from your modules, but not resources or their outputs.
c
@great-sunset-355 I am curious why you think it's an unfortunate design choice? Stack outputs in the
nodejs
runtime perhaps need not have used module exports in the top-level file, i.e. your main file, but the alternative would be to do what is done in the other languages i.e. to expose a Pulumi runtime function that you have to call to export outputs. To me, using the language-provided way to export stack outputs feels natural.
g
I strictly follow exports only in top-level files. However, I much prefer a
pulumi.export
function available in other languages because that does not clash with the language design.
c
You might want to search through issues if there is already an existing feature request. If not, you could open one.