https://pulumi.com logo
#general
Title
# general
h

hundreds-article-77945

01/15/2022, 12:59 AM
Can you access the output of a resource from another stack? Or only stack outputs?
e.g. we have a
gcp:storage/bucket:Bucket
created in an
infra
stack and want to access its name in another stack. In the
infra
stack’s JSON representation, I see that resource has a series of outputs including a
name
field. Can that be accessed programmatically?
p

prehistoric-activity-61023

01/15/2022, 10:33 AM
you can always export the output of the given resource 🙂
So to answer your question more directly - AFAIK you can only access stack outputs from another stack but as I said above, it’s not a problem to export additional values from created resources.
if you need more help, paste the code snippet where you create a bucket or at least tell us what programming lang you use 😉
h

hundreds-article-77945

01/20/2022, 4:25 PM
Sorry, just saw your response! Yeah, we use stack outputs for now. However, it’s duplicative — especially for component resources where we end up having to produce outputs both on the component resource and on the stack. (We’re using Go ftr)
3 Views