https://pulumi.com logo
#general
Title
# general
c

cool-egg-852

10/02/2019, 7:57 PM
I’m curious what people would recommend here: We have a project (CI). We have 4 environments (dev, staging, prod, support). CI runs in support. We need to create a GCP service account in the support stack (we have one stack per env), but then reuse that stack in the other 3 envs so that we can grant it a role in GCP. Given that TypeScript doesn’t allow exporting inside of a conditional, what’s the best way to reference that service account? The issue is due to TS and the way Pulumi requires things to be `export`ed for it to be used in a stack reference.
a

adamant-dress-73325

10/02/2019, 9:05 PM
@cool-egg-852 YMMV, but we use
let
to declare the name, do our conditional assignment by
env
and then export that name at the top-level, kinda eh but it works for us in our base stacks.
c

cool-egg-852

10/02/2019, 9:10 PM
That’s how I’ve done it in the past, but we have multiple files (we only use
index.ts
to include other files). This makes the whole system a PITA as we have to export over and over again. On top of this, we need to have files included conditionally. That’s why I was wondering if there is a better solution.