is there an easier way to get data from the state ...
# general
s
is there an easier way to get data from the state file? Very familiar with terraform and how their remote state works, figuring pulumi has something equivalent
c
What do you have in mind, specifically @square-crayon-17656
b
You can export the state using
pulumi stack export
. It's just a JSON file. Not quite the same as Terraform state files, but hopefully easier to grok and parse since it's just JSON. If you ever want to edit it, you can always import the resulting edits using
pulumi stack import
.
s
Here is my use case. Using the service broker and when you create a service binding it ends up creating a secret with the binding credentials. The secret is created out of band. By that I mean I would create the service binding object via pulumi, once it is bound the service broker creates the secret. As pulumi would not be involved in creating the secret it would not be in its state file. Is there a way for pulumi to query for existing k8s objects and import into its state file
b
@creamy-potato-29402 may have a better idea here. I think you may be wanting https://github.com/pulumi/pulumi-kubernetes/issues/231. This would let you say
let s = k8s.Secret.get("my-existing-secret")
and then use it as an object in your program just like as if you'd used Pulumi to create it, except that Pulumi won't try to manage its lifecycle or anything, it's just a readonly snapshot of its state. Does that sound like what you're after here?
s
I believe .. let me experiment and get back to you. Thanks
@big-piano-35669 Ah, that isn’t implemented yet. But based on the description you gave, yes that sounds like what I want
c
@square-crayon-17656 yeah this is definitely on the roadmap.