【发布时间】:2023-03-18 06:02:01
【问题描述】:
我正在尝试将一些参数传递给嵌套堆栈。
我目前的配置如下:
根模板:
Parameters:
SubnetIds:
Description: The array of Subnet IDs assigned to the lambdas
Type: List<AWS::EC2::Subnet::Id>
SecurityGroupIds:
Description: The array of Security Groups Assigned to the lambda functions
Type: List<AWS::EC2::SecurityGroup::Id>
Resources:
Myresource1:
Type: 'AWS::Serverless::Application'
Properties:
Location: 'resource1/template.yaml'
Parameters:
SubnetIds: !Join [',', !Ref SubnetIds]
SecurityGroupIds: !Join [',', !Ref SecurityGroupIds]
第一个嵌套堆栈:
Parameters:
SubnetIds:
Description: The array of Subnet IDs assigned to the lambdas
Type: List<AWS::EC2::Subnet::Id>
SecurityGroupIds:
Description: The array of Security Groups Assigned to the lambda functions
Type: List<AWS::EC2::SecurityGroup::Id>
Resources:
MySecondLevelResource:
Type: 'AWS::Serverless::Application'
Properties:
Location: 'app/template.yaml'
Parameters:
SubnetIds: !Ref SubnetIds
SecurityGroupIds: !Ref SecurityGroupIds
二级嵌套堆栈:
Parameters:
SubnetIds:
Description: The array of Subnet IDs assigned to the lambdas
Type: CommaDelimitedList
SecurityGroupIds:
Description: The array of Security Groups Assigned to the lambda functions
Type: CommaDelimitedList
使用此配置,当 AWS 尝试部署第一个嵌套堆栈时出现错误,因为它需要一个字符串或字符串对象。 我还尝试在第一级堆栈中使用 CommaDelimitedList 类型,但在第二级仍然出现错误。 到目前为止还没有运气。
有没有人遇到过这种情况或有任何解决方法的想法?
【问题讨论】:
标签: parameters amazon-cloudformation aws-sam nested-stack