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

helpful-ice-5738

02/04/2019, 6:32 PM
Is there a way/plan to have a way to pass arguments that belong to aws.lambda.Function to classes like HttpServer?
l

lemon-spoon-91807

02/04/2019, 10:03 PM
Hi Mia!
Short answer: maybe. However, it depends on what you're trying to pass along.
Another very viable approach (where you want total control over things) is to use aws.apigateway.x.API
h

helpful-ice-5738

02/04/2019, 10:05 PM
One use case is if I want to run the lambda function with python3.6 but have built out all my infrastructure through pulumi with javascript — I want to pass the handler/code in
l

lemon-spoon-91807

02/04/2019, 10:06 PM
Ah, in that case, i would not recommend HttpServer. That's a helper which is really dedicated to make it easy to serve up pure-javascript through Http
if you'd like to run some other sort of lambda (i.e. one that is python backed) here's the pseudo code for how you'd do it:
Copy code
const lambda = new aws.Lambda.Function("name", ...all your args that make sense for the python version...);
const api = new aws.apigateway.x.Api("name", {
    routes: [{
        path: "/yourpath",
        method: "GET",
        eventHandler: lambda,
    }]
});
This is basically what HttpServer is doing itself:
h

helpful-ice-5738

02/04/2019, 10:09 PM
ok cool, so just break it down and implement it myself - that makes sense. I assume I’ll also have to do some manual configuration of IAM that would get done by pulumi if it were all JS
l

lemon-spoon-91807

02/04/2019, 10:09 PM
yes. that's likely true
h

helpful-ice-5738

02/04/2019, 10:09 PM
any status update on your python docs?
l

lemon-spoon-91807

02/04/2019, 10:10 PM
Looks liek we attach these policies:
Copy code
aws.iam.AWSLambdaFullAccess,                 // Provides wide access to "serverless" services (Dynamo, S3, etc.)
    aws.iam.AmazonEC2ContainerServiceFullAccess, // Required for lambda compute to be able to run Tasks
h

helpful-ice-5738

02/04/2019, 10:11 PM
ok cool, thank you!
l

lemon-spoon-91807

02/04/2019, 10:11 PM
For Python questions, i will pull in @incalculable-sundown-82514
i

incalculable-sundown-82514

02/04/2019, 10:13 PM
re: Python docs, a lot of documentation is now live here: https://pulumi.io/reference/pkg/python/index.html
we’re making rapid improvements, so there will be even more there as the week goes on, but hopefully there’s enough there to answer any questions you might have!
(and let me know if there’s not… I’m actively working on Python docs right now)
h

helpful-ice-5738

02/04/2019, 10:13 PM
thanks @incalculable-sundown-82514
l

lemon-spoon-91807

02/04/2019, 10:19 PM
Also, very soon, the 'aws.apigateway.x.Api' will 'graduate' from an eXperimental module to a full fledged module in
@pulumi/awsx
.
👍 1
but htere won't be any changes to the functionality or api shape, it's just moving to a new place, and development on it will continue there instead of in
@pulumi/aws
awsx
is coming very soon, and will be our package for great
aws
-specific advanced functionality
👍 1
h

helpful-ice-5738

02/06/2019, 6:25 PM
@lemon-spoon-91807 is there any specific documentation of ‘aws.apigateway.x.Api’ ? — in python I get
AttributeError: module 'pulumi_aws.apigateway' has no attribute 'x'
l

lemon-spoon-91807

02/06/2019, 6:25 PM
it's only JS/TS for now
h

helpful-ice-5738

02/06/2019, 6:27 PM
ah, I see — right now is the best way to implement python serverless still to use pulumi in JS per above?
l

lemon-spoon-91807

02/06/2019, 6:28 PM
i'll let @incalculable-sundown-82514 weigh in, but probably 'yes'
you can still use the TS/JS to set up all the scaffolding
and then create Lambdas that point to python code
like actual python code files
i

incalculable-sundown-82514

02/06/2019, 6:29 PM
h

helpful-ice-5738

02/06/2019, 6:30 PM
@incalculable-sundown-82514 I tried to implement an api gateway based on that but got the above error… did you mean to send that one?
what do y’all think is the timeline for having python functionality on par with javascript’s?
i

incalculable-sundown-82514

02/06/2019, 6:32 PM
We have a strategy that’s written down here: https://github.com/pulumi/pulumi/issues/2430
Realistically, based on the long-term plan in that issue, it would be at least a month.
h

helpful-ice-5738

02/06/2019, 6:34 PM
awesome - that strategy write up is very helpful @incalculable-sundown-82514, thanks!
i

incalculable-sundown-82514

02/06/2019, 6:35 PM
no problem!
h

helpful-ice-5738

02/06/2019, 7:17 PM
@lemon-spoon-91807 any tips or tricks for passing things like bucket names around/into a python function from the pulumi lambda.function? I have asserted the handler and it’s picking that up fine, but I imagine I’d have to be able to pass arguments from the core javascript in that lambda block to use them in a nested lambda function
ah I can use env 😛
l

lemon-spoon-91807

02/06/2019, 7:19 PM
Copy code
/**
     * The Lambda environment's configuration settings. Fields documented below.
     */
    readonly environment?: pulumi.Input<{ variables?: pulumi.Input<{[key: string]: pulumi.Input<string>}> }>;
yup!