适用于AWS :: ApiGateway :: Resource的AWS Cloudformation模板:如何为RequestParameter创建动态密钥?

问题描述

我正在创建一个cloudformation嵌套模板,该模板创建一个AWS::ApiGateway::Method。该方法具有查询字符串,其名称是从父堆栈作为参数接收的名称,如下所示:

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

问题在于,当前定义查询字符串的方式如下:

RequestParameters:
  method.request.querystring.queryStringName: true

其中true表示查询字符串是否为必需。使用这种方法,queryString名称位于左侧部分(键定义部分),并且您不能在其中使用内部函数!Ref。 是否有我缺少的东西或解决方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)