https://pulumi.com logo
#python
Title
# python
n

numerous-easter-93888

09/09/2019, 7:22 PM
Hi all, I'm having a little difficulty determining exactly how to import outputs from another stack in AWS. Specifically, I have a VPC stack I'm using for all my networking and I need to pull in VPC ID and a bunch of subnet IDs. I have those outputting properly but the example on the site isn't very clear for AWS... Is it as simple as defining a StackReference, then pulling in the output from stack.get_output(), like so?
Copy code
infra = pulumi.StackReference("my/project/stack")
public_subnet_ids = pulumi_aws.Provider("aws", {'public_subnet_ids': infra.get_output('Public Subnet IDs'))
private_subnet_ids = 'pulumi_aws.Provider("aws", {'web_subnet_ids': infra.get_output('Web Private Subnet IDs')
vpc_id = pulumi_aws.Provider("aws", {'vpc_id': infra.get_output('vpc_id')})
h

high-translator-22614

09/09/2019, 7:23 PM
I think so. Haven't had a chance to use them myself, but I believe that's how they work?
n

numerous-easter-93888

09/09/2019, 7:24 PM
¯\_(ツ)_/¯
h

high-translator-22614

09/09/2019, 7:30 PM
what's the actual problem you're having?
n

numerous-easter-93888

09/09/2019, 7:33 PM
Understanding how this is supposed to work...the code above doesn't work, even after fixing the obvious typos
I'm digging around and tracing back where things are failing but was hoping someone on here has already solved this problem
h

high-translator-22614

09/09/2019, 7:38 PM
it might help if you actually said what the problem was
n

numerous-easter-93888

09/09/2019, 7:41 PM
How can I pull in output variables from a different stack, for AWS, in Python? I can't find working examples
h

high-translator-22614

09/09/2019, 7:42 PM
the cloud doesn't matter to pulumi
... you're remembering to export them, right?
n

numerous-easter-93888

09/09/2019, 7:42 PM
Yes, they are exporting properly
h

high-translator-22614

09/09/2019, 7:44 PM
refer to stack by
org/project/stack
(eg,
astraluma/myproject/dev
)
the output names should match the name given in the export
n

numerous-easter-93888

09/09/2019, 7:45 PM
Thank you, I hadn't found that page. That is what I was looking for.
This isn't returning the output information, just a pulumi.output.Output object that I can't do anything with. Has anyone done this in practice and can advise? Thank you!
h

high-translator-22614

09/10/2019, 4:19 PM
oh, that's pulumi futurish/prommisish async value