https://pulumi.com logo
Title
d

dry-kangaroo-89921

05/09/2023, 10:36 AM
Hi, I am creating infrastructure with Pulumi and typescript in GCP (info for context). I see my stack configuration file growing with each new resource, and it is at a point where the config will be over 1000 lines, and it won't stop there. I was wondering is there a way to create other configuration files that you can access in code. I know Pulumi.yaml can be used for shared configuration between the stacks, but I would like to break it up even further, having different configuration stack for resource x, and for resource y etc. The reason I'm thinking about this is because I want to introduce defaults to the configuration to make it more manageable.
e

echoing-dinner-19531

05/09/2023, 11:45 AM
It's just a standard typescript program, you can write functions in other files and then just call them from the main entrypoint file. https://github.com/pulumi/examples/tree/master/aws-apigateway-ts-routes is an example showing an index.ts which imports and calls functions in other files (like dns.ts) to setup more things than would be clean to all have in one file.
d

dry-kangaroo-89921

05/09/2023, 1:25 PM
Do you maybe have some other repos that showcase some of the best practices in pulumi with typescript?
e

echoing-dinner-19531

05/09/2023, 1:57 PM
There's a blog post series about best practices https://www.pulumi.com/blog/iac-recommended-practices-code-organization-and-stacks/ which links to some more example repos of how stuff is setup
d

dry-kangaroo-89921

05/09/2023, 2:15 PM
Thank you!