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

billions-mechanic-26704

09/23/2021, 8:53 PM
Hi Everyone. I am using pulumi and azure python sdk. I want to spread the resources creation across several python files, so I have:
Copy code
__main__.py
azure-appservice.py
But it seems my code is only executed when it is in
__main__.py
and the resources defined on
azure-appservice.py
are not readed when I execute
pulumi up
command. Is there a way to use more than one python file similar to terraform?
b

billowy-army-68599

09/23/2021, 9:04 PM
you can't have it read all the files, but you can import from other files, and separate the resources into components. See here: https://github.com/jaxxstorm/pulumi-nginx-demo/blob/main/nginx-ingress/app.py and here: https://github.com/jaxxstorm/pulumi-nginx-demo/blob/main/nginx-ingress/__main__.py#L45
the way terraform works sorta violates the "principal of least surprise" to me, executing random files you haven't explicitly imported
💡 1
b

billions-mechanic-26704

09/23/2021, 9:23 PM
@billowy-army-68599 thanks, it makes sense under modularity perspective.
4 Views