Hi All, Just started with pulumi and trying to le...
# getting-started
s
Hi All, Just started with pulumi and trying to learn stacks and folder structure. Is this possible and feasible? Maybe there are other better ways to achieve this. Or am I completely wrong here.
Copy code
infra/
  ├── Pulumi.yaml
  ├── Pulumi.product1-rnd.yaml
  ├── Pulumi.product1-dev.yaml
  ├── Pulumi.product1-stg.yaml
  ├── Pulumi.product1-prod.yaml
  ├── Pulumi.product2-rnd.yaml
  ├── Pulumi.product2-dev.yaml
  ├── Pulumi.product2-stg.yaml
  ├── Pulumi.product2-prod.yaml
Pulumi.yaml
Copy code
name: my-gcp-infra
runtime: yaml
description: Infrastructure as Code with Pulumi for GCP
Then each file
Pulumi.productX-XXX.yaml
will have the actual resources to deploy. Where
rnd
,
dev
,
stg
,
prod
are different gcp projects for each product for example gcp projects names:
Copy code
product1-rnd
product1-dev
product1-stg
product1-prod
product2-rnd
.
.
.
I did watch

https://www.youtube.com/watch?v=rDs_Dzl36vw

I did read https://www.pulumi.com/blog/iac-recommended-practices-code-organization-and-stacks/ When I select
zephyr/dev
how Pulumi knows to deploy to
zephyrdev
gcp project and when I do pulumi stack select
zephyr/prod
how does it know to deploy to
sephyrprod
gcp project ? This is confusing, because as I understand there is a single pulumi.yaml containing all of resources.
Copy code
cd infra
pulumi stack select zephyr/dev
pulumi up
Now I get it: Is this correct? • When you run
pulumi stack select zephyr/dev
, Pulumi uses
Pulumi.zephyr-dev.yaml
for the configuration. • When you run
pulumi stack select zephyr/prod
, Pulumi uses
Pulumi.zephyr-prod.yaml
for the configuration. •
main.yaml
is used to keep all the resources and is specified in Pulumi.yaml as?
Copy code
name: my-project
runtime: yaml
description: My Pulumi Project
main: main.yaml
r
I’m new to Pulumi and trying to do something pretty similar than you. I was wondering if a common approach can be to specify all the main resources in the Pulumi.yaml and then have the Pulumi.xxx.yaml overwriting some of the main properties only
s
Thats what I was thinking
till trying to find out
Is anyone able to comment on this, please?
m
You can see some typical examples for organizing projects here: https://www.pulumi.com/docs/using-pulumi/organizing-projects-stacks/#examples