Paolo
Paolo

Reputation: 26074

Enforce non-empty validation for AWS-Specific Parameter Types

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

Answers (2)

Derrops
Derrops

Reputation: 8117

You could try and use a constraint on top of it.

Try this:

"AllowedPattern" : ".+"

Upvotes: 5

Related Questions