How to read string array from SSM to serverless yaml

variables

#1

My serverless is like this:
service: {self:provider.deployVersion}-cph-{opt:service}
provider:
vpc:
securityGroupIds:
- sg-xxx
subnetIds:
- subnet-xxx
- subnet-xxx
- subnet-xxx
stage: ${opt:stage, ‘dev’}

How can i move all vpc variables into a single system parameter store variable so that serverless reads them properly? I tried to same the whole block in SSM but at time of reading, serverless is reading like below : Not sure why |- is getting appended
vpc: |-
securityGroupIds:
- sg-xx
subnetIds:
- subnet-xx
- subnet-xx
- subnet-xx


#2

You can split an SSM string into a list with this syntax:
ssm_var_split: { 'Fn::Split': [ ",", "${ssm:x}" ] }