![](/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.