aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Include parameters from file in template.yaml

Open mnapoli opened this issue 7 years ago • 1 comments

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:
    ...

mnapoli avatar Feb 08 '19 20:02 mnapoli

Great idea! Having a way of splitting up the template.yaml would be awesome to help devs modularise their apps.

mgarciadelojo avatar Jun 05 '19 21:06 mgarciadelojo

This is better suited to be solved by Lambda. We have passed this to the Lambda Team internally.

Closing.

jfuss avatar Dec 20 '22 21:12 jfuss

⚠️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.

github-actions[bot] avatar Dec 20 '22 21:12 github-actions[bot]