https://pulumi.com logo
#typescript
Title
# typescript
s

salmon-account-74572

08/07/2019, 3:01 PM
TypeScript newbie here, so forgive the simple question. The example usage for the
getAvailabilityZones
function in
pulumi/@aws
shows the use of the
output
function to access the data returned by the function. However, the only way I was able to make it work was without the
output
function, like so:
Copy code
const rawAzInfo = aws.getAvailabilityZones({
    state: "available",
});
let azNames: Array<string> = rawAzInfo.names;
let numberOfAZs: number = azNames.length;
Am I missing/overlooking/not understanding something? Or is this an error in the docs?
w

white-balloon-205

08/07/2019, 4:19 PM
The examples should work as written - if you can point at the specific one that doesn't - we could take a look. The change to make it so that the code you have above works as written is very recent, and we will be working on updating all examples to use this (simpler) approach.
s

salmon-account-74572

08/07/2019, 4:20 PM
That example may work as written, but for what I was trying to do (ascertain the number of AZs in the configured region) I could never make it work.
w

white-balloon-205

08/07/2019, 4:22 PM
Got it. Yes - we will make sure to update all the examples to use the simpler synchronous approach once it has been rolled out to all providers.
👍🏻 1