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

famous-dog-78928

01/03/2024, 9:12 AM
I got some questions regarding using Pulumi for setting up lambdas Interested to hear other people's thoughts: https://github.com/pulumi/pulumi/discussions/15019
n

narrow-needle-95047

01/03/2024, 9:23 AM
If you find a way, could you please share it? AWS SAM can do this, hopefully Pulumi can too.
One way could be having the software as an independent module and testing it separately, while testing the Lambda/AWS-specific part after deployment.
m

millions-river-14466

01/03/2024, 3:51 PM
We put the lambda code into a separate module that we can run unit tests on, then use a FileAsset via Pulumi to pull in the code.
Copy code
code: new pulumi.asset.AssetArchive({
            // the FileAsset file name does not have to match the map key
            // the map key is what the file will be in the lambda payload
            // the file as known to the lambda will be used in the 'handler', above
            'index.js': new pulumi.asset.FileAsset(`./lambda/jumpboxAccessReset/jumpboxAccessReset.js`),
        }),
One slight wrinkle: we have to use
ignoreChanges: ['code']
on the Function in Pulumi because we build and deploy from hosted CI/CD -- otherwise running previews locally will constantly generate changes because file paths are different.