https://pulumi.com logo
l

lemon-monkey-228

02/03/2021, 1:56 PM
Is there a way to query for existing resources outside of my Pulumi stack/
b

brave-planet-10645

02/03/2021, 2:09 PM
Do you mean look up a VPC that you're not using Pulumi to deploy?
(for example)
l

lemon-monkey-228

02/03/2021, 2:20 PM
Yeah
In this case, a Kubernetes resource (a service)
b

brave-planet-10645

02/03/2021, 2:34 PM
I am going to have to look into that as I don't think you can with the Kubernetes provider
l

lemon-monkey-228

02/03/2021, 3:13 PM
I guess I could do it directly using the Kubernetes SDK since it’s just TS
b

brave-planet-10645

02/03/2021, 3:50 PM
So no there doesn't seem to be a way that you can do this like other resources
g

gorgeous-egg-16927

02/03/2021, 4:44 PM
Hmm, it seems to be missing from our API docs, but k8s does have
.get
methods for every resource type. Here’s the Service one for example: https://github.com/pulumi/pulumi-kubernetes/blob/62f8055cd47ab5572e278eac70d7484fb802319d/sdk/nodejs/core/v1/service.ts#L45-L47
FYI, the id format for get/import is
[namespace/]name
e.g., for a Service called
foo
in the
bar
namespace, it would be
bar/foo
l

lemon-monkey-228

02/04/2021, 9:24 AM
Just seen this, thanks!
Will give it a whirl now
Is there any way to look up a resource without the name? Just out of curiosity
4 Views