Amazon web services CloudFormation嵌套堆栈参数从String/ComaDelimitedList转换为';映射键值对';
我正在将参数从cloudformation主堆栈传递到'AWS::ApiGateway::Method'资源的RequestParameters属性的嵌套堆栈 支持的CloudFormation参数类型(数据类型)有:字符串、数字、列表、CommaDelimitedList和AWS特定的参数类型,如下所述: 是否可以将参数值设置为字符串(或CommaDelimitedList),并在嵌套堆栈中将其转换为映射键值对,因为“AWS::ApiGateway::Method”资源的RequestParameters属性需要它 键值对的映射如下所示:Amazon web services CloudFormation嵌套堆栈参数从String/ComaDelimitedList转换为';映射键值对';,amazon-web-services,amazon-cloudformation,aws-api-gateway,Amazon Web Services,Amazon Cloudformation,Aws Api Gateway,我正在将参数从cloudformation主堆栈传递到'AWS::ApiGateway::Method'资源的RequestParameters属性的嵌套堆栈 支持的CloudFormation参数类型(数据类型)有:字符串、数字、列表、CommaDelimitedList和AWS特定的参数类型,如下所述: 是否可以将参数值设置为字符串(或CommaDelimitedList),并在嵌套堆栈中将其转换为映射键值对,因为“AWS::ApiGateway::Method”资源的RequestPara
Resources:
LambdaEndpointMethod:
Type: AWS::ApiGateway::Method
Properties:
RequestParameters:
method.request.querystring.param1 : true
method.request.querystring.param2 : true
method.request.querystring.param3 : true
我已经尝试指定参数类型字符串,并将所有键值对作为逗号分隔的字符串传递,然后使用Fn::Split内在函数分割字符串,但cloudformation抱怨属性RequestParameters的值必须是对象
这是我的嵌套堆栈模板:
Parameters:
RequestParametersString:
Description: List of request parameters
Type: String
Default: ''
...
Conditions:
EmptyRequestParametersString: !Equals [ !Ref RequestParametersString, '' ]
...
Resources:
LambdaEndpointMethod:
Type: AWS::ApiGateway::Method
Properties:
RequestParameters: !If [ EmptyRequestParametersString, 'AWS:NoValue', !Split [',', !Ref RequestParametersList] ]
MyNestedStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: ...
Parameters:
...
RequestParametersString: 'method.request.querystring.param1 : true, method.request.querystring.param2 : true, method.request.querystring.param3 : false'
这是我的主模板:
Parameters:
RequestParametersString:
Description: List of request parameters
Type: String
Default: ''
...
Conditions:
EmptyRequestParametersString: !Equals [ !Ref RequestParametersString, '' ]
...
Resources:
LambdaEndpointMethod:
Type: AWS::ApiGateway::Method
Properties:
RequestParameters: !If [ EmptyRequestParametersString, 'AWS:NoValue', !Split [',', !Ref RequestParametersList] ]
MyNestedStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: ...
Parameters:
...
RequestParametersString: 'method.request.querystring.param1 : true, method.request.querystring.param2 : true, method.request.querystring.param3 : false'
有没有办法在cloudformation上实现这一点,或者有人能提供一个解决方案,如何将几个键值对作为参数从主堆栈传递到子堆栈