I'm trying to get a list of organization account id's from our AWS account.
I have the following code
const acc_list: string[] = [];
(async () => {
const orgs = await aws.organizations.getOrganization();
orgs.accounts.forEach(account =>
acc_list.push(account.id))
})()
console.log(acc_list)
Which logs an empty list because clearly the console command is running before the promise.
My goal is I want to send the list of accounts to a different function (different file) in my typescript application. No clue how to do that.