high-grass-3103
08/01/2025, 9:22 PMpulumi state move
command worked great, the biggest struggle I had was with my old resource structure.
Thanks, Pulumi team!little-cartoon-10569
08/03/2025, 8:19 PMhigh-grass-3103
08/05/2025, 10:56 PMlittle-cartoon-10569
08/05/2025, 11:17 PM// file1.ts
import * as aws from '@pulumi/aws;
export default function bucket() {
new aws.s3.Bucket('bucket');
}
// index.ts
import createBucket from './file1';
createBucket();
This is not recommended:
// file1.ts
import * as aws from '@pulumi/aws;
new aws.s3.Bucket('bucket');
export {}
// index.ts
import x from './file1';
high-grass-3103
08/07/2025, 7:00 PMimport * as ${provider} from '@pulumi/${provider}'
imports the main index.
Only in my case I also have a project that sets up resources.
So I have two options:
1. I make a single base project for both resources and exported code. I can't use import * as base from 'company-base'
since that would create the same resources the second time (first time in company-base project).
2. I make two projects, one for pulumi script that sets up the base resources, and another one for common functions and classes. This gives me the convenience of importing the index, just like with any other provider.
The second option is cleaner.
Another thing is splitting git repositories; so far I'm using a single monorepo (pnpm), while pulumi docs recommend keeping pulumi code with the apps. Adding outside dependencies is a more involved with either accessing private git repos (ensuring access for all users) or setting up a private npm repo, again with access for all.little-cartoon-10569
08/07/2025, 9:14 PMYou do normally import index, every import * as ${provider} from '@pulumi/${provider}' imports the main index.Yes, for libraries this is the case. These are recognizable because index.ts is usually just a pile of exports. For index.ts files with side effects (e.g.: create resources), you shouldn't do this. Don't import a Pulumi project: do import a library that provides Pulumi component resources, and functions that create resources.
little-cartoon-10569
08/07/2025, 9:15 PMlittle-cartoon-10569
08/07/2025, 9:16 PMhigh-grass-3103
08/08/2025, 12:05 AMlittle-cartoon-10569
08/08/2025, 12:07 AM