Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource metadata is removed when converting 'AWS::Serverless::Function' to 'AWS::Lambda::Function' #264

Closed
sunnyone opened this issue Jan 23, 2018 · 9 comments
Labels
stage/pm-review Waiting for review by our Product Manager, please don't work on this yet type/bug type/feature

Comments

@sunnyone
Copy link

sunnyone commented Jan 23, 2018

"Metadata" in AWS::Serverless::Function is removed when it's converted to AWS::Lambda::Function.

  MyFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: index.handler
      Runtime: nodejs6.10
      Policies:
        - Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Action:
                - cloudformation:DescribeStackResource
              Resource: (...ARN...)
    Metadata:  # <--- REMOVED!!!
      CustomData: ABC
      ImageConvertFunctionArn: !ImportValue OtherFunctionArn

Resource metadata is useful to customize behaviors in a function on Lambda@Edge since it does not support environmental variables of Lambda.

@jamesjia94
Copy link

Also running into the same issue

@Simon2228
Copy link

Unfortunately, resource metadata is currently not supported in SAM yet. You can submit a PR for this feature. Otherwise, we will prioritize this accordingly.

@jlhood
Copy link
Contributor

jlhood commented Jan 9, 2020

This issue came up for cfn-lint since Metadata can be used to add inline cfn-lint configuration within a template. See aws-cloudformation/cfn-lint#1294 for details.

One question I have is: should SAM (1) pass Metadata on AWS::Serverless::Function through to just the AWS::Lambda::Function resource or (2) pass Metadata through to all resources created as a result of that AWS::Serverless::Function? My intuition is we should go with (1), but just wondering if anyone has a use case for (2)?

@PatMyron
Copy link
Contributor

PatMyron commented Jun 17, 2020

One question I have is: should SAM (1) pass Metadata on AWS::Serverless::Function through to just the AWS::Lambda::Function resource or (2) pass Metadata through to all resources created as a result of that AWS::Serverless::Function?

Inclined towards 2. Easier to support going forward and makes more sense for every AWS::Serverless resource type to blindly pass metadata to every resource it creates because we can't understand all use-cases. If we pick and choose passing to only certain resources created by AWS::Serverless resources, we end up with the same problem where there are still certain resources where customers cannot set metadata

@drAlberT
Copy link

Metadata should be supported, and preserved, in Globals too .. to avoid C&P Metadata in multiple function

@RonitRudra
Copy link

Any updates on preserving metadata? We're trying to use the resource-level metadata in order to support configuration of custom macros.

@awsjeffg awsjeffg added the stage/pm-review Waiting for review by our Product Manager, please don't work on this yet label Sep 4, 2020
@c2tarun
Copy link
Contributor

c2tarun commented Feb 2, 2021

Closing this ticket as the fix is merged.

@c2tarun
Copy link
Contributor

c2tarun commented Feb 11, 2021

This issue is still not resolved from SAM side.

@c2tarun c2tarun reopened this Feb 11, 2021
@mndeveci
Copy link
Contributor

mndeveci commented Jun 9, 2021

Closing this issue since it is been released with SAM v1.36.0 and SAM CLI v1.24.0.

You can read more about how resource level attributes are handled in SAM via our updated documentation; https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-resource-attributes.html

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/pm-review Waiting for review by our Product Manager, please don't work on this yet type/bug type/feature
Projects
None yet
Development

No branches or pull requests