https://pulumi.com logo
Title
s

straight-crayon-4578

05/03/2022, 8:00 PM
When using python, is it possible to have more than one
__main__.py
for one project? eg.:
pulumi up file.py
?
b

billowy-army-68599

05/03/2022, 8:02 PM
pulumi will always look for
__main__.py
- are you want to break your code into distinct files?
s

straight-crayon-4578

05/03/2022, 8:04 PM
@billowy-army-68599 yes, I've used the
import
feature and now there is lots of variables hardcoded, I went something like a main file for prod and another for dev...
b

billowy-army-68599

05/03/2022, 8:05 PM
that's what stacks are for..
you use stacks, stack configuration and then ise the same code between prod and dev
s

straight-crayon-4578

05/03/2022, 8:09 PM
So, I've imported this:
container = aws.ecs.TaskDefinition("Foo",    
    ...
    task_role_arn="arn:aws:iam::393964450433:role/ECSTaskRole-123",
    ...)
Then I should:
my_task_role_arn = pulumi.Config('foo').get('bar')

container = aws.ecs.TaskDefinition("Foo",    
    ...
    task_role_arn=my_task_role_arn,
    ...)
b

billowy-army-68599

05/03/2022, 8:11 PM
corrrect!
the for each stack
pulumi config set task_role_arn <foo>
s

straight-crayon-4578

05/03/2022, 8:12 PM
@billowy-army-68599 Thanks!!