Hey guys, I wanted to share a cool way to set stac...
# typescript
b
Hey guys, I wanted to share a cool way to set stack output values from files other then the
index.ts
. Usually the way to set outputs is to
export
it from the main
index.ts
but i found myself wanting to export values from other files and pulumi does not seem to have an answer to that. Here's what you can do:
Copy code
function setOutput(key: string, value: any) {
  require(process.env.PWD + '/index')[key] = value;
}
you can call this function from anywhere to set stack outputs, i hope this helps someone