I'm trying to enforce an allowed pattern with regex on my parameter, but when I try to build my stack, I get the following error message:
Template validation error: Template error: Parameter 'myParam' AllowedPattern must be on a parameter of type String
This is my Parameter definition:
"myParam": {
"Description": "this is my param",
"Type": "CommaDelimitedList",
"AllowedPattern": "\\+[0-9\\-\\ ]+",
"MinLength": "1"
}
I believe you can't do regex on CommaDelimitedList. Regex can only be applied on strings.
CommaDelimitedList – An array of literal strings that are separated by commas
Your parameter is of type CommaDelimitedList
, not String
. Attribute AllowedPattern
(also MinLength
) only applies to type String
.
See eg http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html for more details.
AllowedPattern (and AllowedValues) for CommaDelimitedLists are now supported in CloudFormation parameters. If you apply an AllowedPattern or AllowedValues on a CommaDelimitedList, the constraint is checked for each item in the list. See the documentation here:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.