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

magnificent-apartment-79511

03/15/2024, 12:23 PM
I have some resources I'm conditionally creating depending on the stack or other factors. Is there a way to conditionally export a value only when a resource is created? In other languages there seems to be the ability to use a
pulumi.export('name', value)
but not in typescript.
v

victorious-church-57397

03/17/2024, 7:27 PM
You can do
export let varName
and then set it conditionally. Pulumi only exports the outputs if they’re not undefined
g

great-sunset-355

03/29/2024, 5:45 AM
you can either use
export
in the
index.ts
or
exports["vpc_id"] = vpc.vpc.id;
, also search the thread or https://archive.pulumi.com/ for more creative solutions