Reputation: 26074
In my cloud formation template, I am using a few AWS-Specific Parameter Types. For example:
"VPC": {
"Description": "Choose exiting VPC",
"Type": "AWS::EC2::VPC::Id"
},
allows the user who is deploying the stack to choose from a dropdown VPC list.
I noticed that if I were to not pick a VPC and leave that parameter blank, the stack does deploy, only to fail shortly afterwards because this parameter was left empty.
I went through the documentation here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
but did not find anything which explained this behavior.
Is there any way to enforce non-empty validation for these parameters (i.e. ensure that the user does choose a value) ? I would like to ensure that an error pops up as soon as one clicks Create stack
. For normal parameters, I can use AllowedPattern
to enforce a certain pattern. Is there anything similar for these parameter types?
Upvotes: 4
Views: 1657
Reputation: 4638
In addition to an AllowedPattern
of .+
which will result in Parameter 'VPC' must match pattern .+
before stack deployment, you can also try CloudFormation Template Constraint Rules:
Upvotes: 3