The Terraform AWS Lambda Function resource support...
# aws
c
The Terraform AWS Lambda Function resource supports use of either a) S3 or b)
filename
arguments to supply the code deployment package. In Pulumi, in both TS/JS and Python, only the S3 option seems to be available. A couple of questions: 1) Why is this the case? 2) My understanding is that the Pulumi providers are usually auto-generated from the corresponding Terraform provider. Where is the logic that removes the
filename
argument in this case? (Or is auto-generation not used?)
(Originally posted in #general then moved here)
g
Some of the Pulumi providers are built on top of corresponding Terraform providers - including AWS. In most cases, there's a 1:1 mapping of resources and their arguments, but in some cases we've changed the arguments add on additional functionality. Lambda is one of these cases where we've changed the interface a bit. The corresponding argument for
filename
in Pulumi is
code
- https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/aws/lambda/#FunctionArgs-code.
c
Thanks, Cameron. I will give
code
a try soon, I’m sure it will work!
Are you able to point me to the logic or specification that does this particular mapping? My basic understanding is that
tfgen
processes “overlays” to achieve this. But I have not found an example overlay. The “AWS overlays directory” link at the bottom of this README returns a 404: https://github.com/pulumi/pulumi-terraform-bridge
g
My understanding is the
resources.go
in each provider defines this - e.g. here's the
code
option for
aws_lambda_function
- https://github.com/pulumi/pulumi-aws/blob/master/resources.go#L1476-L1495
c
Oh, excellent. This is very illuminating. Nice trick to auto-populate the source code hash while you are at it.