Hi, How are you modularizing your pulumi code?
In general, I end up having multiple .ts files, where I have usually one main function that is imported and called from index.ts.
Example:
# index.ts
import { setupPermissions } from './permissions.ts'
setupPermisions(parameterA, parameterB)
# permissions.ts
export func setupPermisions(a, b) {
pulumi resources...
}
bland-pharmacist-96854
10/17/2024, 4:58 PM
maybe instead of this should I do a component resource in each module? 🤔
l
little-cartoon-10569
10/17/2024, 6:44 PM
There's any number of ways to do it, and they all have their advantages.
I always use ComponentResources as it gives me very definite boundaries for unit testing (everything in a ComponentResource) and where I can use elements like
pulumi.runtime
and
pulumi.Config
(index.ts only).
b
bland-pharmacist-96854
10/17/2024, 7:37 PM
yes this is what I am realizing that might feel more natural or "the pulumi way"