elegant-dress-88912
12/12/2019, 5:04 AMcreateServiceAccount: true
elegant-dress-88912
12/12/2019, 5:10 AM// somewhere in index.ts
if (config.createServiceAccount) {
const serviceAccount = new ...
const serviceAccountKey = new ...
export const serviceAccountPrivateKey = serviceAccountKey.PrivateKey
}
won't work, because
1. later I would need to access object props of, say, serviceAccount, but this variable scope is limited by if
block
2. `export`'s seems to be not allowed in nested blocks in typescriptelegant-dress-88912
12/12/2019, 5:11 AMlet serviceAccount: type
before if
block, but not sure what to do with the 2ndambitious-ram-5811
12/12/2019, 5:13 AMlet serviceAccountPrivateKey: TypeOfThePrivateKeyType;
if (config.createServiceAccount) { ... }
export serviceAccountPrivateKey;
elegant-dress-88912
12/12/2019, 5:18 AMelegant-dress-88912
12/12/2019, 5:22 AMexport
after if
saying 'variable is used before assignment'elegant-dress-88912
12/12/2019, 5:22 AMlet serviceAccountPrivateKey: pulumi.Output<string>
before if
elegant-dress-88912
12/12/2019, 5:24 AMbored-jackal-93148
12/12/2019, 5:24 AMlet serviceAccountPrivateKey: pulumi.Output<string | undefined>
ambitious-ram-5811
12/12/2019, 5:24 AMlet serviceAccountPrivateKey = default(ThatType)
bored-jackal-93148
12/12/2019, 5:25 AMlet serviceAccountPrivateKey: pulumi.Output<string> | undefined depending on where in the onion you are
ambitious-ram-5811
12/12/2019, 5:25 AMambitious-ram-5811
12/12/2019, 5:25 AMbored-jackal-93148
12/12/2019, 5:26 AMbored-jackal-93148
12/12/2019, 5:27 AMbored-jackal-93148
12/12/2019, 5:27 AMbored-jackal-93148
12/12/2019, 5:28 AMelegant-dress-88912
12/12/2019, 5:28 AMelegant-dress-88912
12/12/2019, 5:29 AMdefault(pulumi.Output<string>)
looks invalid exprambitious-ram-5811
12/12/2019, 5:29 AMlet foo: [anything you type here]
, it doesn't actually assign itelegant-dress-88912
12/12/2019, 5:29 AMelegant-dress-88912
12/12/2019, 5:30 AMbored-jackal-93148
12/12/2019, 5:30 AM| undefined
bored-jackal-93148
12/12/2019, 5:30 AMbored-jackal-93148
12/12/2019, 5:30 AMexport const foo = undefined
bored-jackal-93148
12/12/2019, 5:30 AMlet x: string | undefined
elegant-dress-88912
12/12/2019, 5:30 AMbored-jackal-93148
12/12/2019, 5:30 AMexport x
will workambitious-ram-5811
12/12/2019, 5:30 AMdefault(Type)
was a thing but oh well - just write let serviceAccountPrivateKey: pulumi.Output<string>? = undefined
bored-jackal-93148
12/12/2019, 5:31 AM