https://pulumi.com logo
Title
d

damp-school-17708

04/14/2021, 4:34 PM
Hi again, I am trying to follow the advice of splitting a 'monolitic' infra into 'mini-projects'... So I've started to move out the lambdas into a 'funtions' projects and then leave everything else into an 'infrastructure' project. If I pulumi up in infra I delete the functions, that's good, and expected. When I pulumi up in the functions project I reference the required infrastructure, all good, create the functions, good. But it's also trying to delete all the other infrastructure. Both projects share the same 'dev' stack. What I am doing wrong? Or this is expected as first step to move things around? Thanks a lot
b

billowy-army-68599

04/14/2021, 4:38 PM
it sounds like your infrastructure might be in your functions project state, you'll need to move them if that's the case
👍 1
d

damp-school-17708

04/14/2021, 4:39 PM
actually looking at this https://github.com/pulumi/examples/tree/master/aws-stackreference-architecture it seems like I have to create a new stack for each project, is that the case? So part of my problem might be that 'functions' is a subfolder of infrastructure? And they are in the same stack?
b

billowy-army-68599

04/14/2021, 4:41 PM
you'll need to
pulumi new
a new project and move the code into that, then migrate it out of the state
👍 1
projects hold your code, stacks are implementations of that code with config differences
g

green-musician-49057

04/14/2021, 4:44 PM
We just completed doing something similar (and with CI/CD hooked up to boot). You'll want to import the lambda function resources over into the
functions
project once you've created it
d

damp-school-17708

04/15/2021, 8:33 AM
@green-musician-49057 which I think it's kind of what this script does https://github.com/pulumi/pulumi/issues/3389 right
g

green-musician-49057

04/15/2021, 4:59 PM
That's a neat script, kind of wish I had seen it earlier 😂 It would have helped us a little bit, but we also had custom providers (e.g. non-default AWS provider pointing to
us-east-1
for example). I did it mostly by hand using the pulumi cli, and it wasn't too bad b/c we only had about 20-30 resources in total across all stacks.