Next beginner question ( :slightly_smiling_face: )...
# general
c
Next beginner question ( 🙂 ) As pulumi tags on an “id” number on resource names, they become rather difficult to find. In fact the “get”-methods become quite useless as they for most part operate on the obfuscated name property. As the reasons for doing this (I know there’s a way to enforce the supplied name) are quite valid and the functionality very useful, well… In AWS a strategy to handle this would be to use tags on the objects and then find them that way. Could you give me an example of that, i.e. finding say an aws EC2 with the tag/value “foo: bar”? That would solve the problem right away.
s
@colossal-alarm-90650 I don’t know the solution for getting a resource by AWS resource-tag. But what do you want to achieve? Perhaps a StackReference is the right thing to use here. I mean the resource you want to get is already managed by Pulumi, or?
c
It’s managed by another project. The object is created outside of the process I am running so I need a way of identifying whether it actually is there at all, and if so to retrieve and use it.
But I get what you mean… I could, conceivably, introspect the other project’s stack and obtain the name by digging around in there… hm. Ugly, but… feasible.
Still, it would be a lot better if I could simply use the tags for what they actually are intended… hm.
s
I see. Would be an interesting feature. Would you mind creating an issue for it? Then it’s better tracked than here 🙂
c
It does need a feature request? I figured it’d be a standard application of the AWS library? Perhaps not… strange.
m
Could you use
aws.ec2.getInstance
? It seems to offer a couple of ways to query by tag: https://www.pulumi.com/docs/reference/pkg/aws/ec2/getinstance/
c
Perhaps…. but this was “for example”. Let’s take… well, a vpc then? Or a bucket? A WebAcl, something where the get function only accepts a name.
There’s unfortunately many of them.