Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CloudFormation - set multiple default values for type of List<>

When I'm creating CloudFormation template with the use of interactive Parameters, I can define the type of List<> to be able to select multiple values, for example:

SubnetIds:
  Type: List<AWS::EC2::Subnet::Id>
  Description: Select multiple subnets from selected VPC.
  Default: "????"

or:

SecurityGroups:
  Type: List<AWS::EC2::SecurityGroup::Id>
  Description: Select security groups.
  Default: "???"

The question is how do I pre-set default value with multiple selections? if default takes only the string instead of a list, and string with commas between multiple values also doesn't help

Any ideas? please, hint me

like image 691
Briksins Avatar asked Jan 01 '23 21:01

Briksins


1 Answers

I recently run in the same issue. The answer is simple - there should be no spaces in your comma-separated list. So it would look like:

SecurityGroups:
  Type: List<AWS::EC2::SecurityGroup::Id>
  Description: Select security groups.
  Default: "sg-11111111,sg-22222222"

And this way the values would be preselected in your template.

P.S. Do not try CommaDelimitedList or so - it won't work in the way you want. The string values would be selected, but not the actual security groups.

Source: https://forums.aws.amazon.com/thread.jspa?threadID=165144

like image 53
Mykola Korol Avatar answered Apr 27 '23 18:04

Mykola Korol