This feature request indicates that it should be possible to include multiple files in the Resources section. I want to do this to better manage a large file with hundreds of resources in it.
However, doing this
resources:
Resources:
- ${{file(1.yaml)}}
- ${{file(2.yaml)}}
Results in a template with the Resources key set to a list, which looks like
"Resources": [
{
"Resource1": {
"Type": "AWS::Logs::SubscriptionFilter",
...
}
},
...
Which fails when the template is uploaded to CloudFormation:
Error --------------------------------------------------
The CloudFormation template is invalid: Template format error: Any Resources member must be an object.
What is the proper way to use this feature? I’ve tried this dozens of different ways in multiple versions of serverless and using $file in the Resources section always results in the variable not being interpreted, interpreted wrongly as in this bug report, or producing invalid output in the CF template.