Hi, I am getting started with Pulumi and soon hope...
# getting-started
g
Hi, I am getting started with Pulumi and soon hope to manage a few hundered GKE and AKS clusters using it. If I understand correctly, resources should be mentioned in the
Pulumi.yaml
and then various stacks such as
Pulumi.dev.yaml
or
Pulumi.stag.yaml
can be used to provide overrides. Is it possible to have resources in different files such as a
Pulumi.yaml
for VPC and Networking etc and then another one for Storage and so on ? I would also like to understand if it is possible to share output among these files? Thanks!
g
I asked this recently and the answer was no but it's being tracked here; https://github.com/pulumi/pulumi-yaml/issues/227
q
Are you looking to have multiple stacks for those different things you mention, and then integrate them (e.g. use the subnets created in the networking stack as an input to the storage stack)?
If so, I think ESC can help with that - although I'm new to the Pulumi ecosystem, so happy for someone to correct me or clarify
g
Are you looking to have multiple stacks for those different things you mention, and then integrate them (e.g. use the subnets created in the networking stack as an input to the storage stack)?
Correct. that is what I am looking. Thanks for linking the issue @gifted-gigabyte-53859 It is exactly what I looking for. 🙂
@quick-machine-30319 I am not 100% sure if ESC is the right solution for this. I feel ESC would be needed eventually to add correct overrides for secrets and configuration but for a project / stack in general we need a way to avoid a giant yaml containing all resources.
l
Is it possible to have resources in different files such as a Pulumi.yaml for VPC and Networking etc and then another one for Storage and so on ?
This is what projects are for. You can have a networking project (with stacks), a storage project (with stacks), etc. In general, different stacks from a single project shouldn't refer to each other. It becomes too hard to manage deployment order and dependencies. When projects are used for this purpose, there's generally no problem defining deployment order: networking must be deployed before storage. But stacks contain different copies of the same resources, so why would stackX have to be deployed before (or after) stackY? They're non-overlapping copies of the same resources, so they're independent by definition.
g
I was wondering that a project can have multiple resources and stacks. For example: 1. A project named
gcp
2. The project then has stacks corresponding to env like gcp-dev, gcp-staging, and gcp-prod 3. The project also has various resources (in different yaml files) such as VPCs, GKE cluster, buckets etc 4. These config for resources can be managed under the stack, such a gcp-dev specifies the regions and project for all resources
l
That should work. I don't know about the YAML restrictions; it's certainly the way it works in various languages. Maybe you need to use an import directive? Or list the "source code" YAML files in the project YAML file?
Apparently there is no built-in import directive. However, you can transpile / pre-compile to YAML, so you can use a tool, maybe roll-your-own or yglu or something, to build multiple input YAML files into a single output YAML file. Use the
compiler
option described here: https://www.pulumi.com/docs/languages-sdks/yaml/#compiler-support