loud-bear-51491
10/06/2021, 4:16 PMinfra/groups.ts(6,14): error TS2322: Type 'Promise<string>' is not assignable to type 'string'.
here is the code
const current = aws.getCallerIdentity({});
export const accountId: string = current.then(current => current.accountId);
if (accountId == "xxx") {
const devops = new aws.iam.Group("devops", {
name: "devops-users",
path: "/",
});
}
steep-toddler-94095
10/06/2021, 4:47 PMaccountId
is a Promise<string>
so you can't so a comparison with a string
in your if
. You'll need to do this comparison in a context where the promise is unwrapped, either within a .then
or after the variable is `await`edlittle-cartoon-10569
10/06/2021, 9:33 PMpulumi.getStack()
returns a simple string.