https://pulumi.com logo
Title
c

colossal-ram-89482

02/24/2020, 1:00 AM
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

gentle-diamond-70147

02/24/2020, 3:57 PM
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

colossal-ram-89482

02/25/2020, 3:55 AM
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

gentle-diamond-70147

02/25/2020, 4:02 AM
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

colossal-ram-89482

02/25/2020, 4:14 AM
Oh, excellent. This is very illuminating. Nice trick to auto-populate the source code hash while you are at it.