Feature request: Add directives to reference multiple template files
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Describe your idea/feature/enhancement
I wish there was a way to build/deploy same with multiple templates. As templates grow larger, it is hard to maintain all of the resources in a single file including the parameters, mappings and globals. I wish there was a way where we can directly reference another template file from a template file.
### Proposal
Having directives such as `!Include` where we can reference the other templates within a template so we can have separate template file for parameters, mappings etc.
template-parameters.yaml
```
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
MyParameter1:
Type: String
MyParameter2:
Type: String
```
template-resources.yaml
```
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: my-function
Runtime: nodejs14.x
Handler: index.handler
```
main-template.yaml
```
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
# Reference the parameters from template-parameters.yaml
Parameters:
- !Include template-parameters.yaml
Resources:
# Reference the resources from template-resources.yaml
- !Include template-resources.yaml
# Additional resources can be defined here.
```
Things to consider:
1. Will this require any updates to the [SAM Spec](https://github.com/awslabs/serverless-application-model)
### Additional Details
Contributor guide
Assessment
This issue has not been assessed yet.