``` const environment = new aws.elasticbeanstal...
# aws
h
Copy code
const environment = new aws.elasticbeanstalk.Environment(appName, {
        name: appName,
        application: application.name,
        solutionStackName: solutionStack.name,
        settings: devSettings,
    })

    const instance = aws.ec2.getInstance({
        instanceId: environment.instances[0]
    }).then(instance => instance.privateDns)
l
Don't use
getInstance
, that looks up instances using the AWS SDK and returns the current state. You could try using
aws.ec2.Instance.get()
. It uses Pulumi's outputs to wait for values to be available. I haven't tried it in this use case though...
h
I thought you could not use get in a pulumi run
l
You can always use <client>.get. You cannot use <output>.get().
Alternatively: `aws.ec2.Instance.get()`: 👍 . `aws.ec2.Instance.get().id.get()`: 👎
h
The tricky thing here is that the instances will not be available until you deploy something in Beanstalk. So I don’t really want to wait in the pulumi run
Here’s what I ended up doing
Copy code
if (environment.instances[0].length > 0) {
        instance = await aws.ec2.getInstance({
            instanceId: environment.instances[0]
        })
        exports["instance"] = instance.privateDns
    }
l
Then there won't be in
id
, will there?
h
instances
just ends up being empty. I guess this situation is a special case
l
That's probably the right thing to do. If you use
Instance.get()
, it goes into your stack as a read-only resource. And if the id changes, it might count as an update, and mess up your CI comments, etc.
h
👍