is there a way to have stack outputs in a differet...
# typescript
b
is there a way to have stack outputs in a differet file rather the index.ts?
s
Yeah there is, hopefully others will comment if this is a better way of doing it but heres what I have seen/do As a very basic example: in `index.ts`:
Copy code
export * from './resources';
And then in
resources.ts
just create your outputs as you would normally along with your other resources (you have to export them in this file as well so they are available for export in
index.ts
).
b
so this way I could use that in combination with import('./resources')
and what about if I want to export something from inside a function?
s
yeah you can import the function into index and call it to create your resources, and I'd probably just return whatever you want from the function and then create an output from it. I'm pretty new to
pulumi
and I think things that are exported "all the way" become outputs automatically? Just have a play around with it
b
I mean, in general I'm struggling a little bit about how to organize my pulumi code by ts modules, but probably is my lack of TS knowledge. In general I do things like: index.ts import {myresurces} from ./mymodule myresources() {} mymodule.ts myresources() {resources}