Hi guys, I’m trying to use `StackReference` and pr...
# python
Hi guys, I’m trying to use
and print in the following example the
variable, can anyone share an example?
Copy code
other = StackReference("stg")
other_output = other.get_output("regions")
returns an output (think of it like a future). That output can be passed to other pulumi functions, but if you need to do string manipulation, or print the raw value, you'll have to use
Thanks @lemon-agent-27707 for the response. I’ll explain my situation, I have multiple stacks project, each stack has it’s own regions configurations
Copy code
vpc_network:regions: {
    "europe-west1": "",
    "europe-west3": "",
    "us-central1": "",
    "us-east1": ""
in the beginning of the project run (
pulumi up
) I want to verify there is no collision with any network in the other stacks. I’m trying to create two lists: 1. long list of all the existing stacks networks
Copy code
["", "", "", "", ""]
2. list of current stack networks.
Copy code
["", ""]
then check if there is collision between them. • How do I get all stacks in the project? • How do I get current stack variable? • How do I compare between 2 lists of Pulumi objects? Thanks a lot
Have you had a chance to look at this documentation? https://www.pulumi.com/docs/intro/concepts/organizing-stacks-projects/ It gives an overview of using stack references. I don't believe we have an API in the SDKs to list all stacks, but there is a CLI command. You could always shell out and execute this command: https://www.pulumi.com/docs/intro/concepts/stack/#listing-stacks
If you have a stack per region, you may consider having two config values associated with each of your stacks, one for all regions, and one for the current region. Then you could construct a stack reference for each, and use pulumi.all to wait for all of the stack refs to be available: https://www.pulumi.com/docs/intro/concepts/programming-model/#all
thanks. is there anyway to convert pulumi object into regular python object?
Can you provide some detail on your use case and what you're trying to accomplish? In general you can only access the raw value inside of
, but you can always pass an output as an input to another resource.