CDK SpecRestApi with CognitoUserPoolsAuthorizer with multiple User Pools for OpenAPI 3.0.x API

0

Hello,

In my CDK (Python) stack, I'm trying to use OpenAPI to define my APIs that were previously written directly in CDK. I've exported the current setup to OpenAPI JSON and it looks like this:

  "components" : {
    "securitySchemes" : {
      "MyUserPoolAuthorizer" : {
        "type" : "apiKey",
        "name" : "Authorization",
        "in" : "header",
        "x-amazon-apigateway-authtype" : "cognito_user_pools",
        "x-amazon-apigateway-authorizer" : {
          "type" : "cognito_user_pools",
          "providerARNs" : [ "arn:aws:cognito-idp:us-east-1:xxxxxxxxx:userpool/us-east-1_T1LjPI6Vc", "arn:aws:cognito-idp:us-east-1:xxxxxxxxx:userpool/us-east-1_abc", "arn:aws:cognito-idp:us-east-1:xxxxxxxxx:userpool/us-east-1_def", "arn:aws:cognito-idp:us-east-1:xxxxxxxxx:userpool/us-east-1_ghi", "arn:aws:cognito-idp:us-east-1:xxxxxxxxx:userpool/us-east-1_jkl" ]
        }
      }
    }
  }

The list of providerARNs is based on user pools set up in the CDK definition. How can I convert this to a CDK definition (without hard-coded values like the user pool ARN)? I've looked at CfnParameters, but I am having trouble because the values aren't known at runtime. I am thinking something like Fn::Join ["", [${MyListResource]] might work, but I've had no luck with this. I see in this link how to do some basic substitution, but not how to pass a list around.

Any suggestions would be appreciated! Cheers, Jonathan

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions