@here,does anyone has an idea how can we achieve m...
# getting-started
n
@here,does anyone has an idea how can we achieve modular approach in pulumi, likewise we do in terraform. I have created different modules within one stack ..it's not able to fetch the variables from configuration file (pulumi.yaml) inside each module. Help me out in this .
m
Several options here, depending on how you've laid things out.
I have created different modules within one stack ..it's not able to fetch the variables from configuration file (pulumi.yaml) inside each module
Can you share a bit more detail? It sounds like you've got only one "stack", but multiple
Pulumi.yaml
files sounds you may have multiple stacks. If you explain a bit more what you're trying to read and from where, it'd be easier to make some recommendations.
n
Right now I'm exploring and working on pulumi to deploy infrastructure. Before which I had done using terraform modular approach, the same thing I'm trying to do using pulumi ..I have created 2 modules inside each module I have main.py, pulumi.yaml files. And I have one main.py file which is common and outside all the modules where I'm importing all modules and running pulumi up command.But it's not fetching the configuration values from pulumi.yaml file.I'm using dev stack.
m
Can you do something like
tree
to show what your directory structure looks like? From your description, it sounds like this:
Copy code
.
├── project-a
│   ├── Pulumi.yaml
│   ├── Pulumi.dev.yaml
└── project-b
│   ├── Pulumi.yaml
│   ├── Pulumi.dev.yaml
└── __main__.py
Is that what you have? Or something different?
n
This is my directory structure
Copy code
.
├── az storage
│   ├── main.py
│   ├── Pulumi.yaml
└── az aks
│   ├── main.py
│   ├── Pulumi.yaml
└── __main__.py
m
Ok thanks. Two more questions: • Is
__main__.py
trying to read from the other
main.py
files, or from the `Pulumi.yaml`s? Wondering what it is you're trying to read exactly. • What's the error you get when you try to run
pulumi up
?