https://pulumi.com logo
Title
e

enough-truck-34175

03/26/2021, 2:44 PM
Hi all. Is it possible to combine multiple stack files? For context, I need to deploy 12 Kubernetes clusters globally and have a separate stack for each cluster. All the clusters are production clusters, so it would be great to overlay each cluster stack onto another config like
Pulumi.production.yaml
. This would make it easy to maintain common configuration in one place.
b

better-shampoo-48884

03/26/2021, 3:31 PM
Could try automation? define one stack, then use that as an overlay/default for others.
i.e. maintain 12 stacks but have them all be executed from one place with one config (possibly in paralell depending on how things work out)
e

enough-truck-34175

03/26/2021, 5:38 PM
I like the idea of the overlay, but I’m wondering how to handle encrypting secrets. If the default production stack has secrets, it wouldn’t work with the overlay because the secrets will have a different
encryptedkey
. Am I understanding this correctly?
b

better-shampoo-48884

03/26/2021, 5:48 PM
well, that's true.
though, technically, with automation you could handle your secrets manually.
i.e. directly interface with vault or keyvault or whatever it might be during your exectution
👍 1
e

enough-truck-34175

03/26/2021, 9:19 PM
I ended up using this package to merge yaml files. https://github.com/miracl/conflate
filename := "Pulumi.esus-k8s-play-5-a.yaml"

c, err := conflate.FromFiles(filename, "Pulumi.play.yaml")

overlay, err := c.MarshalYAML()

ioutil.WriteFile(filename, overlay, 0644)
I’m using the same
encryptkey
for both stacks, so the overlay doesn’t affect the secrets.
And that happens before pulumi
run()
b

better-shampoo-48884

03/27/2021, 6:29 AM
that's awesome 😄