Posted On: Dec 27, 2022
AWS CloudFormation now supports AllowedValues and AllowedPattern properties for CommaDelimitedList parameter type. You can use the CommaDelimitedList parameter type to specify multiple string values in a single parameter. For example, you can create three different subnets with their own VPC CIDR blocks, and use CommaDelimitedList to specify three different CIDR blocks. With these language enhancements, you can add validation checks to your CommaDelimitedList, and reduce input errors to your CommaDelimitedList while updating your stacks and/or stack sets.
You can use AllowedValues to pass an array containing the list of values allowed for the parameter, and AllowedPattern to pass regular expressions representing the patterns allowed for String types. You can use these features with CommaDelimitedList to define acceptable inputs, and minimize errors when creating or updating a stack or stack set. For example, you can use AllowedValues to allow values such as “10.0.48.0/24”, “10.0.112.0/24”, and “10.0.176.0/24” for CommaDelimitedList parameter of VPC CIDR blocks. This will act as guardrails that minimize human errors when updating the VPC CIDR blocks parameter. Additionally, you can use AllowedPattern for specifying valid email address patterns to a CommaDelimitedList parameter. You can use a pattern such as “/[^\s@]+@[^\s@]+\.[^\s@]+/” as valid developer email address that acts as an input to provision AWS::EC2::VPC resource type.
These features are available in US East (Ohio and N. Virginia), US West (N. California and Oregon), Africa (Cape Town), Asia Pacific (Hong Kong, Hyderabad, Jakarta, Mumbai, Osaka, Seoul, Singapore, Sydney, and Tokyo), Canada (Central), China (Beijing) operated by Sinnet, and China (Ningxia), operated by NWCD, Europe (Frankfurt, Ireland, London, Milan, Paris, Spain, Stockholm, and Zurich), Middle East (Bahrain, and UAE), South America (São Paulo), and AWS GovCloud (US-East) and (US-West) Regions.
To learn more about Parameters, refer to the CloudFormation documentation.