I can pass a single value, e.g. VPC id like so:
npx cdk deploy --parameters vpcId=vpc-12345
And then access it inside the stack like so:
const vpcId = new cdk.CfnParameter(this, "vpcId", {type: "String"});
const vpc = ec2.Vpc.fromVpcAttributes(this, "myVPC", {
vpcId: vpcId.valueAsString,
availabilityZones: [0, 1].map(i => cdk.Fn.select(i, cdk.Fn.getAzs('ap-southeast-2'))),
publicSubnetIds: publicSubnetIds.valueAsList, // ["subn1", "subn2"]
privateSubnetIds: privateSubnetIds.valueAsList
});
But when I do:
npx cdk deploy --parameters publicSubnetIds=subnet0001,subnet0002
And then:
const publicSubnetIds = new cdk.CfnParameter(this, "publicSubnetIds", {type: "List<String>"})
I get a single entry in the result [ '#{Token[TOKEN.62]}' ] if I do publicSubnetIds.getValueAsList, not an array of two values as expected.
How do I pass multiple values in cli parameters, such as array of subnet Ids?