salmon-account-74572
06/22/2020, 8:35 PMaws.getAvailabilityZones
and using the results to a) create an array of strings to capture the AZ names and b) use the length
function on said array of strings to determine how many AZs were in the region. I thought that wrapping the aws.getAvailabilityZones
in pulumi.output
and then using apply
would get me back to working, but it appears not. Code is threaded below.const rawAzInfo = aws.getAvailabilityZones({
state: "available",
});
let azNames: Array<string> = rawAzInfo.names;
let numberOfAZs: number = azNames.length;
const rawAzInfo = pulumi.output(aws.getAvailabilityZones({
state: "available",
}));
let azNames = rawAzInfo.apply(rawAzInfo => rawAzInfo.names);
let numberOfAZs = azNames.length;
TS complains that I can't define azNames
as Array<string>
because of type mismatch. If I remove the type definition, then I can't define numberOfAZs
as a number
due to type mismatch, and then that breaks some numerical operations later in the code.faint-table-42725
06/22/2020, 8:54 PMthen
of the promise or use https://www.pulumi.com/docs/intro/languages/javascript/#entrypoint to use top-level await
salmon-account-74572
06/22/2020, 9:11 PMthen
to no avail, so I think I need to spend some time understanding the concepts a bit better.faint-table-42725
06/22/2020, 10:02 PM