![](/img/trans.png)
[英]Dis-AllowedPattern for Cloudformation parameter value constraint?
[英]Enforce AllowedPattern for parameter of type CommaDelimitedList in Cloudformation script
我试图在我的参数上使用正则表达式强制执行允许的模式,但是当我尝试构建我的堆栈时,我收到以下错误消息:
模板验证错误:模板错误:参数“myParam”AllowedPattern 必须位于字符串类型的参数上
这是我的参数定义:
"myParam": {
"Description": "this is my param",
"Type": "CommaDelimitedList",
"AllowedPattern": "\\+[0-9\\-\\ ]+",
"MinLength": "1"
}
我相信你不能在CommaDelimitedList上做正则表达式。 正则表达式只能应用于字符串。
CommaDelimitedList - 由逗号分隔的文字字符串数组
您的参数是CommaDelimitedList
类型,而不是String
。 属性AllowedPattern
(也是MinLength
)仅适用于String
类型。
有关详细信息,请参阅http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html 。
CloudFormation 参数现在支持 CommaDelimitedLists 的 AllowedPattern(和 AllowedValues)。 如果您在 CommaDelimitedList 上应用 AllowedPattern 或 AllowedValues,则会针对列表中的每个项目检查约束。 请参阅此处的文档:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.