AWS Cloudformation template for AWS::ApiGateway::Resource: How to create dynamic key for RequestParameter?

598 views Asked by At

I am creating a cloudformation nested template that creates an AWS::ApiGateway::Method. That method has query strings with names received as parameters from the parent stack something like this:

Parameters:
    #...other parameters
    queryStringName:
        Type: String
    queryStringMandatory
        Type: String
        AllowedValues: [true,false]
Resources:
    ApiGatewayMethod:
        Type: 'AWS::ApiGatewayMethod::Method'
        Properties:
        #... other properties
        RequestParameters:
            # here I want to inject somehow the queryStringName into the key definition
            method.request.querystring.{$queryStringName}: !Ref queryStringMandatory #doesnt work

The problem is that the current way to define a query string is like this:

RequestParameters:
  method.request.querystring.queryStringName: true

where true indicates if the query string is mandatory. Using this way the queryString name is in the left part (the key definition part), and you can't use intrinsic functions there or !Ref. Is there something I am missing or is there a workaround for this?

0

There are 0 answers