Multiple or Unknown Number of entries in config

Hi,

My question is about configuration.

I got in the serverless.yml file the following

  vpc:
    securityGroupIds:
      - ${self:custom.config.sg1}
      - ${self:custom.config.sg2}
    subnetIds:
      - ${self:custom.config.subnet1}
      - ${self:custom.config.subnet2} 
custom:
  config: ${file(environments/config.${opt:stage, self:provider.stage}.yml)}

In the environments folder i got the relevant yml files

Problem is in my production environment i want to add more subnets so pre-defining subnet1 and subnet2 will not work.

How can i load all entries from my enironments/config.prod.yml file?

Which by the way looks like the following

vpc:
  subnets:
    subnet1: subnet-xxxx
    subnet2: subnet-xxxx
    subnet3: subnet-xxxx

Cheers

Something like this may work.

Change your environment config’s to:

vpc:
  securityGroups:
    - sg-xxxx
    - sg-xxxx
    - sg-xxxx
  subnets:
    - subnet-xxxx
    - subnet-xxxx
    - subnet-xxxx

Then use this for your serverless.yml

vpc:
  securityGroupIds: ${self:custom.config.vpc.securityGroups}
  subnetIds: ${self:custom.config.vpc.securityGroups.subnets}
custom:
  config: ${file(environments/config.${opt:stage, self:provider.stage}.yml)}