Question on pulumi codebase refactoring. Initially...
# general
c
Question on pulumi codebase refactoring. Initially we started with a flat TS stack, no modules, pretty much everything in index.ts. Our infra has grown quite a bit now and we are refactoring our code into modules. Our first
pulumi preview
now shows that it wants to delete and recreate almost every resource. It clearly shouldn't need to as all the resources exist, but will it try to?
m
Preview shouldn't care where the resources are defined -- have the resource names changed at all?
c
no, we pretty much 1:1 copied resource definitions from index.ts into modules, passing required values into the modules.
We'll check again, but nothing should have changed
l
If the parents have changed, or the names, then you'll see this. The diff will tell you why the deletes / recreates are happening (though it might not be obvious; you need to know what to look for). If it's because of a re-parenting or a name change, then aliases will fix the problem.
c
Will check, but like I said, all we did was copy code from index.ts to other files. We'll try to run a local diff, github action doesn't really show a lot.
l
Copying code can cause values to change! Maybe the resource names are based on the current file name?
The action should show everything. The preview output is all you need.
c
nah, we weren't that clever when we started 3 years ago 😉 Will check and let you know. Thanks.
okay, got it now. A big non-incident. A whitespace made it into a string for one resource, that propagated down to all the others
😄
m
Nice! 😅