How to use multiple resources definitions in the Serverless Framework

How to use multiple resources definitions in the Serverless Framework

In other Serverless projects we use a single resource definition to include AWS CloudFormation scripts in our build/deploy. Where the resource file contained component definitions like DDBTable: in the root.

resources:
  Resources: ${file(resources.yml)}

However a new project contains a lot of AWS configurations so I decided to split it up. You can do that using the next syntax. However make sure your files start with the Resources: data type.

resources:
  - ${file(resources/resources-vpc.yml)}
  - ${file(resources/resources-db.yml)}

You can even mix and match inline and external resources

resources:
  - Resource:
      ApiGatewayRestApi:
        Type: AWS::ApiGateway::RestApi
  - ${file(resources/resources-vpc.yml)}
  - ${file(resources/resources-db.yml)}