Copying this question from the typescript room, in...
# aws
Copying this question from the typescript room, in case this has a more general answer: How do I get a lambda using an S3 source to update its source code when a new zip file is uploaded to the bucket? Even if I push a new zip to the S3 bucket, the lambda function won't update on 
$ pulumi up
 . The bucket in question does have versioning enabled.
To clarify, are you updating the code in the S3 bucket via Pulumi? Or outside of Pulumi?
In this case, it would be outside of Pulumi.
Is the S3 bucket under Pulumi management at all?
No, the S3 bucket is outside of the stack in this case @witty-candle-66007
So, that’s the root issue. Since Pulumi doesn’t know the S3 bucket changed, it doesn’t know to try and update the Lambda resource. But you should be able to use the S3 Object version as an indicator of a change to Pulumi. I think if you add a call to you can obtain the S3 Object’s version ID. And then add the
property to your Lambda Function creation and set it to the version retrieved from the getbucketobject() call. I haven’t tested this, but I’m thinking this should cause Pulumi to update the Lambda function on pulumi up.
👍 1
👀 1
Thanks. That sounds like it would work, I'll give it try. It would be nice if Pulumi automatically checked the version ID of the object on
pulumi up
, but I'm not sure if that would produce undesirable behavior in some cases.
Didn't work in this case. The object version of the Lambda will update, but the lambda won't pull the most recent version of the code.
@witty-candle-66007 Nevermind, it did go through. Thanks again. 👍