【发布时间】:2021-04-12 11:42:54
【问题描述】:
我正在使用无服务器框架在 AWS 上部署 API。我的serverless.yml 文件中有以下内容:
custom:
vpcSettings:
private:
securityGroupIds:
private:
fn::split:
delimiter: ','
value: ${env:VPC_SG_ID}
VPC_SG_ID 包含以下字符串:sg-1111111111,sg-222222222,sg-3333333333
但是,在部署应用程序时,我收到以下错误:
An error occurred: MyLambdaFunction - Value of property SecurityGroupIds must be of type List of String.
如果我对 SG 列表进行硬编码,它可以正常工作:
custom:
vpcSettings:
private:
securityGroupIds:
private:
- "sg-1111111111"
- "sg-2222222222"
- "sg-3333333333"
为什么 fn::split 函数没有返回字符串列表?
编辑:
以下配置导致同样的错误
custom:
vpcSettings:
private:
securityGroupIds:
private:
Fn::Split:
- ','
- ${env:VPC_SG_ID}
【问题讨论】:
-
以下解决方案是否使用Split from parameter work?
-
@cramix 你是怎么解决这个问题的?
标签: amazon-web-services yaml amazon-cloudformation serverless-framework