https://pulumi.com logo
#typescript
Title
# typescript
g

great-sunset-355

10/07/2023, 7:52 AM
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

little-cartoon-10569

10/07/2023, 8:00 PM
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

clever-sunset-76585

10/07/2023, 11:46 PM
@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

great-sunset-355

10/08/2023, 9:52 AM
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

clever-sunset-76585

10/08/2023, 9:56 AM
You might want to search through issues if there is already an existing feature request. If not, you could open one.