Is there some way to define a `apigateway.RestAPi`...
# aws
b
Is there some way to define a
apigateway.RestAPi
using OpenAPI but do not rely on the
x-amazon-apigateway-integration
that is used within the OpenApi spec? Why I want this? Since the spec is JSON ARN and other has to be hardcoded, so I loose the advantage of referring to a lambda (
const myLambda = aws.lambda.Function
) defined with pulumi as code.
Hey @billowy-army-68599 . I see you're answering quite a lot of questions (thats nice!). I would be very happy if you could help me with this question too, or might tag somehow that could help me instead.
Maybe @little-cartoon-10569 could you point me into the right direction? I wouldn't ask directly if I otherwise would have found an answer here, on stackoverflow, pulumi docs or aws docs 😬
l
This is over my head, I'm afraid. I don't understand the question. I don't even know how it relates to Pulumi. Looks like an AWS topic?
b
First thanks a lot for the answer @little-cartoon-10569! May I explain it a bit differently: Pulumi Crosswalk for AWS - API Gateway offers a really nice way to connect an api gateway endpoint with a specific lambda, here
helloHandler
as a
const
(no ARN / URI)
Copy code
{
      path: "/",
      method: "GET",
      eventHandler: helloHandler,
    },
That of course do not work when I am defining my api in JSON with OpenAPI. So to connect my endpoints with a lambda, it is suggested to use
x-amazon-apigateway-integration
. But when I use that, and correct me if I am wrong, I need to connect endpoint and a specific lambda via the arn/uri (not sure which, still a beginner) that I have to look after creating my
helloHandler
lambda using pulumi. For me, it would be more efficient if I could connect them directly using
helloHandler
as a reference to my lambda. Thus, my question is, if there is a way to connect my endpoint defined in my OpenAPI Json with my
helloHandler
lambda without manually copy/pasting the arn/uri of that lambda into the json using
x-amazon-apigateway-integration
? Thanks a lot in advance! Thus
l
Sorry, still above my pay grade. 'x-amazon-apigateway-integration' looks like a HTTP header to me, and Pulumi code doesn't expose that sort of detail to users. If you're generating a JSON payload for a HTTP or API call you're making outside of Pulumi, and if you've created the lambda using Pulumi, then your options are either 1. to export the ARN or URI from the Pulumi app and use it wherever you're creating your payload, or 2. to apply the ARN or URI within the Pulumi app and generate the payload inside the apply block.