Include parameters from file in template.yaml
Describe your idea/feature/enhancement
Bref provides Lambda runtimes for PHP. The problem is dealing with layer versions (we had to build runtimes.bref.sh to track them).
The idea would be to let users of the layers forget about versions. E.g.
Resources:
SimpleFunction:
Type: AWS::Serverless::Function
Properties:
Handler: function.php
Runtime: provided
Layers:
- !Ref PhpLayer
# instead of
#- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73:1'
The problem: making that PhpLayer parameter available "automatically" to users.
Proposal
I was trying to use Fn::Transform and the Include feature of CloudFormation, but I couldn't get it to work no matter what I tried.
I'm guessing it's conflicting with Transform: AWS::Serverless-2016-10-31? Is there a way we could include sub-templates in template.yaml?
The sub-template would define the PhpLayer parameter with the appropriate value, and would be managed through PHP's package manager (Composer, the PHP equivalent of npm). For example:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
# this file defines the `PhpLayer` parameter
Location: "file://vendor/bref/parameters.yaml"
Resources:
...
Great idea! Having a way of splitting up the template.yaml would be awesome to help devs modularise their apps.
This is better suited to be solved by Lambda. We have passed this to the Lambda Team internally.
Closing.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.