https://pulumi.com logo
#golang
Title
# golang
r

ripe-shampoo-80285

04/16/2021, 12:14 AM
Can we use Golang to create a lambda function with inline handlers in other languages such as TypeScript or Python? Moreover, TypeScript has this capability. Can we do something similar in Golang?
b

billowy-army-68599

04/16/2021, 12:20 AM
this is only available in TypeScript at the moment
r

ripe-shampoo-80285

04/16/2021, 6:10 PM
Thanks for answering my questions. Looks like there are still big gaps between Pulumi TS and other languages. Conceptually, it should be pretty easy to add support for inline lambda handler with any specified run time, but I could be wrong -- was wrong too many times before 🙂 Many time, the lambda handlers are fairly trivial, having support for inline handler could really be handy.
w

white-balloon-205

04/17/2021, 5:58 AM
The only fundamental thing missing between TypeScript and other languages is this specific feature - called “closure serialization”. It’s a rather specific feature that we haven’t yet come up with a perfect way to replicate in other languages. You can of course still define your Lambdas separately in Go. We’re definitely interested in figuring out how to support this in Go as well - but it’s not immediately clear how best to do this. In particular, it likely can’t work in the same way the TypeScript support works - but it is possible that the same binary used for the Pulumi deployment could possibly also be made to work as a Lambda implementation as well (though in general it would need to be re-cross-compiled for Amazon Linux). If you have thoughts on how you’d like this to work - definitely upvote and leave the notes at https://github.com/pulumi/pulumi/issues/3820.
r

ripe-shampoo-80285

04/17/2021, 6:05 PM
Hi Luke thanks for the response. I certainly don't have enough knowledge to fully appreciate the underlying technical challenges. Just to clarify, what I have been asking for is not support for an inline version of Golang Lambda function. That could be a little tricky as it needs to be cross-compiled -- as you pointed out. I was thinking about is to have Golang Pulumi code support provisioning of an inline version of TypeScript/Python Lambda handler. Would than make it any easier? I guess, at minimum, we would need to detect changes of any inline TypeScript/Python lambda function to determine if an updated is required.
4 Views