Hi! I'm new to Pulumi and I'm having trouble with ...
# python
Hi! I'm new to Pulumi and I'm having trouble with the sometimes Output, sometimes Awaitable situation.
Hi, are you trying to define a resource or to obtain information on a resource that already exists?
Info on an existing resource and use that on new resources.
So you can do aws.ec2.get_subnet_ids(). You don't need to pass a resource name
You can see here that you have ways of creating new resources and also "Functions" which are mainly used to obtain information on resouces that don't have to be managed by Pulumi. https://www.pulumi.com/docs/reference/pkg/aws/ec2/
Yes, it returns an Awaitable that I don't know how to use.
If you create a resource with Pulumi, then you already have all the information related to it.
Check the Outputs on that page. You have "id", "ids", "tags", "vpc_id" and "filters"
So something like this:
Copy code
subnet_ids = aws.ec2.get_subnet_ids(...)
would then get you a set of all the subnet ids
But I get an Awaitable I cannot use directly. What am I missing?
You're right, it does seems iffy. I'm trying and even with the example provided it doesn't work
OK, let's get back to the basics: what are you trying to do?
I'm testing out Pulumi to see if it's sensible to use. So far: no. The particular test I'm running requires to get one VPC (not managed), get some subnets (not managed) and create a Spot Fleet in there configured to use the selected subnets. I need the IDs of the subnets for the LaunchConfiguration and I need to specify one subnet ID per LaunchConfiguration AFAICS.
I can get the subnet IDs as an Awaitable but I don't know how to await it.
I tried to instantiate a Vpc object and use
thing as a wrapper for the Awaitable but it just filled my RAM.
It's really unfortunate. I personally think Pulumi has some rough edges, but it's the most capable tool. I'm sorry that you've hit this problem so early in your evaluation and I'm sorry that I haven't been able to help.
I don't think Awaitable is the problem here, it's just bad documentation (it's auto-generated from Terraform in this case)
A real programming lang makes a big difference for us but it does not seem to be well maintained. Maybe it's just Python and JS is working great.
That has definitely not been my experience. Developers are usual on top of things and bugs are addressed in a timely manner.
I think you just hit a snag. I would suggest creating a bug report and see how it goes from there.
But the doc has invalid code and iterating over an Output (I suppose a common rookie mistake) has an open issue since July (https://github.com/pulumi/pulumi/issues/5028). Additionally, although the code is asynchronous, it does not use
but instead implements a JS like interface.
❤️ 1