cold-rocket-35235
05/13/2020, 11:37 AMimport * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const attempt1 = async () => {
let instances = await aws.ec2.getInstances({}, { async: true });
// Property 'forEach' does not exist on type 'GetInstancesResult'.ts(2339)
instances.forEach((instance) => {
console.log(instance.instanceTags);
});
};
const attempt2 = async () => {
let instances = pulumi.output(aws.ec2.getInstances({}, { async: true }));
// Property 'forEach' does not exist on type 'Output<UnwrappedObject<GetInstancesResult>>'.ts(2339)
instances.forEach((instance) => {
console.log(instance.instanceTags);
});
};
const attempt3 = async () => {
let instances = pulumi.output(aws.ec2.getInstances({}, { async: true }));
instances.apply((instances) => {
// Property 'forEach' does not exist on type 'UnwrappedObject<GetInstancesResult>'.ts(2339)
instances.forEach((instance) => {
console.log(instance.instanceTags);
});
});
};
faint-table-42725
05/13/2020, 5:28 PMPromise<GetInstancesResult>
which is not an array you can iterate over. You’ll see that that interface has a bunch of fields on which you can interate.GetInstancesResult
against which you’ll want to use one of its properties like ids
or instanceTags
to iteratecold-rocket-35235
05/13/2020, 6:10 PM(node:28738) UnhandledPromiseRejectionWarning: Error: Program run without the Pulumi engine available; re-run using the `pulumi` CLI
and pulumi preview
gets me
Manage your Pulumi stacks by logging in.
Run `pulumi login --help` for alternative login options.
Enter your access token from <https://app.pulumi.com/account/tokens>
or hit <ENTER> to log in using your browser :
I was wondering if there is a low-commitment way to check things outfaint-table-42725
05/13/2020, 6:53 PM