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

elegant-dress-88912

12/12/2019, 5:50 AM
thanks for you help. I ended up with
Copy code
// somewhere in index.ts
let serviceAccount: TypeOfServiceAccount;
export let serviceAccountPrivateKey = pulumi.Output("");

if (config.createServiceAccount) {
  serviceAccount = new TypeOfServiceAccount(...)
  const serviceAccountKey = new ...
  serviceAccountPrivateKey = serviceAccountKey.PrivateKey
}
So serviceAccount and serviceAccountPrivateKey are global vars and can be used later, private key is exported during declaration, serviceAccountKey is local var in
if
block cause I don't need it elsewhere