Parameters Cloudformation-将参数传递到二级堆栈
我试图将一些参数传递给嵌套堆栈 我当前的配置如下: 根模板:Parameters Cloudformation-将参数传递到二级堆栈,parameters,amazon-cloudformation,aws-sam,nested-stack,Parameters,Amazon Cloudformation,Aws Sam,Nested Stack,我试图将一些参数传递给嵌套堆栈 我当前的配置如下: 根模板: 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 lamb
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]
在这种配置下,当AWS尝试部署第一个嵌套堆栈时,会出现一个错误,因为它需要字符串或字符串对象。
我还尝试在第一级堆栈中使用CommaDelimitedList类型,但在第二级堆栈中仍然出现错误。
到目前为止还没有运气
有没有人经历过这种情况,或者对如何解决它有什么想法?首先,您的模板中有一个重大错误:
SubnetIds: !Join [',', !Ref SecurityGroupIds]
使用securitygroupid
将导致失败,因为securitygroupid
不是子网,而不考虑任何其他问题
另外,嵌套堆栈是使用创建的,它的语法与您正在使用的不同。因此,如果您通过AWS::CloudFormation::Stack
实际使用嵌套堆栈,那么传递参数的方式是正确的。我修复了问题中的yaml(错误的复制和粘贴)。关于堆栈的使用,我认为在这种情况下它不会改变<代码>AWS::Serverless::Application
作为嵌套堆栈部署
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
SubnetIds: !Join [',', !Ref SecurityGroupIds]