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

eager-area-86739

10/24/2018, 2:26 PM
Hi, There is any way to trigger a deployment of
ApiGateway
ad-hoc? My scenario: 1. Created the ApiGateway using Swagger Specs, backed by a lambda 2. Deploy 3. Update the stack adding a
ApiKey
and
UsagePlan
, and updating the Swagger Spec to secure the API 4. Deploy 5. The ApiGateway acknowledge that
ApiKey
is there, but once we go to the Deployment in the AWS console, the
ApiKey
is not deployed 6. In the AWS Console, force the deploy of the
ApiGateway
7. The
ApiKey
is deployed and used by the API
w

white-balloon-205

10/24/2018, 3:15 PM
Yes - this is an awkward part of how API Gateway is managed. You actually have to force the
Deployment
resource to get replaced to ensure a new deployment of the API is done when there are changes. We implement the necessary logic for this here: https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/apigateway/experimental/api.ts#L220 Note that you likely can just use that
aws.apigateway.x.API
implementation to get this behavior “for free”. It supports both passing Swagger explicitly as well as passing a simpler list of routes.
e

eager-area-86739

10/24/2018, 3:52 PM
I imagine so. I can force the
Deployment
resource to be deployed? Given that I'm using
pulumi up --yes
in the CI/CD pipeline, I need to instruct it on my
index.js
file.
@white-balloon-205 what I.m not getting is how can I move from the
RestApi
to the
x.API
class, given that I'm creating the rest of the resources
w

white-balloon-205

10/24/2018, 4:28 PM
What other resources are you creating? What I meant was “force the Deployment resource to be recreated”. That is accomplished on the line of code I linked above which has a comment describing why it works. This doesn’t require changing how you run
pulumi update
.
e

eager-area-86739

10/24/2018, 4:29 PM
As example:
<https://gist.github.com/joaoasrosa/d193d837044ea157b8e2eda4ac1ad798>
Got it now.
I wasn't looking to the correct link. 😐
Copy code
variables: {
                version: swaggerString.apply(sha1hash),
            }