https://pulumi.com logo
#getting-started
Title
# getting-started
c

crooked-plastic-7855

09/30/2023, 6:56 PM
Would love to hear about this, have been hacking it for the last week. Feels like swimming upstream.
b

billowy-army-68599

09/30/2023, 6:58 PM
how can we help?
c

crooked-plastic-7855

09/30/2023, 9:47 PM
Thank you so much. In my case, I’m migrating my current implementation and have been pretty eager to use pulumi. From different repositories into a monorepo (turbo n pnpm) and have been quite easy to set up. My biggest hurdle has been in deploying the code for lambdas and tasks in typescript. My folder structure currently is: turbo.json package.json pnpm-lock.yaml pnpm-workspace.yaml apps - infrastructure - fns - authors - comic-books - web packages - core The
packages/core
contains the entirety of the business logic. The
apps/fns
is the middle place where the core package is imported and exposed to the lambda handler and the
apps/infrastructure
holds the pulumi code which deploys the lambda with the code in fns app. The following are the solutions I’ve tried: • Created a callback function that imports the fns app directly into infrastructure and calls its exports inside of the callback. The result is that the dependencies from core are logged as not found. • Archives do not work because it requires the code be in javascript first. • Tried creating a docker image in which I bundle the code in esbuild but because the dockerfile is located in fns, it doesn’t include the code from packages/core nor the pnpm-lock file that is at the root. • Also tried bundling it outside of the docker image, in the pulumi file but for some packages the architecture mismatches from the lambda one. What I’m trying to achieve is the separation of infrastructure, backend code as (micro tasks) and web and trying to reuse as much as code as possible (core) between backend and frontend.
b

billowy-army-68599

10/01/2023, 12:11 AM
It’s not super clear what the issue is, but my assumption here is that you’re struggling with depedencies?
c

crooked-plastic-7855

10/01/2023, 12:42 AM
Yeap, these attempts I’ve tried so far haven’t gotten me so far a solution in which dependencies (lock file, local modules, node_modules) are bundled appropriately and my code built for the lambda function.
b

billowy-army-68599

10/01/2023, 1:11 AM
I’d recommend keeping the application and infrastructure dependencies completely separate.
c

crooked-plastic-7855

10/01/2023, 1:19 AM
Could you suggest an approach to build the lambda function in the pulumi file in which I can include these dependencies present in the fns package? I currently have the dependencies of infrastructure and application in different packages. It’s this division that I don’t know how to approach to consolidate them in the lambda function.