eesh, bit quiet in here today. anyhoo, are there a...
# general
i
eesh, bit quiet in here today. anyhoo, are there any guides on migrating from a monolith project to micro-stacks? I found this, but it's very conceptual-level and doesn't provide any practical steps: https://www.pulumi.com/docs/using-pulumi/organizing-projects-stacks/#moving-from-a-monolithic-project-structure-to-micro-stacks There are also some github issues about people manually transferring resources between stack, project or org, but it seems to be a manual process right now (stack import/export?)
s
Transferring resources between stacks is currently a manual task, unfortunately. We want to do some things to improve that experience. One thing we have done recently is added some validation to
pulumi stack import
to ensure that the import file is valid. Aside from that, though, it’s a matter of moving resources between stacks (you can use
pulumi stack export
and
pulumi stack import
here to help) and refactoring code to match.
q
ehh I am a newish pulumi user. But adding on to this, is it possible to create a project structure that prevents slamming everything into
main.go
? The project structure I am hoping for is to some how have my pulumi scripts as a module and maybe the yaml files for configuration? Possibly have:
Copy code
infrastructure/
  code/[main.go, vpc.go, ec2.go]
  pulumi.yaml
  pulumi-dev.yaml
I could make a new message to avoid slamming @icy-controller-6092 request, but I can kind of see a relationship here
s
@quick-laptop-52657 Yes, definitely possible! You’ll need to create functions in your
vpc.go
and
ec2.go
files that accept context and pass back any properties you need to reference elsewhere, then call those functions from
main.go
. I need to hop into a meeting, but I’ll try to see if there’s an example somewhere I can point you to.
@quick-laptop-52657 This probably isn’t the greatest example, but it should illustrate the idea sufficiently: https://github.com/scottslowe/learning-tools/tree/main/pulumi/eks-from-scratch
q
Well in my opinion this is a great example and this gives me everything I was looking for! Thank you so much ❤️
s
No problem, happy to help