https://pulumi.com logo
#general
Title
# general
c

colossal-room-15708

11/14/2023, 11:25 PM
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

miniature-musician-31262

11/14/2023, 11:29 PM
Preview shouldn't care where the resources are defined -- have the resource names changed at all?
c

colossal-room-15708

11/14/2023, 11:30 PM
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

little-cartoon-10569

11/14/2023, 11:48 PM
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

colossal-room-15708

11/14/2023, 11:50 PM
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

little-cartoon-10569

11/14/2023, 11:51 PM
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

colossal-room-15708

11/15/2023, 12:02 AM
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

miniature-musician-31262

11/15/2023, 1:30 AM
Nice! 😅
2 Views