question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWS::Serverless::Function ignores resource-based metadata

See original GitHub issue

*cfn-lint version: 0.25.0

Hi, I have the following cfn template (just a sample, I can’t provide my organization’s template) named sample-template.yaml:

# Metadata:  # nodeJS8.10 EOL warning
#   cfn-lint:
#     config:
#       ignore_checks:
#       - W2531
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
  Lambda:
    Metadata:  # nodeJS8.10 EOL warning
      cfn-lint:
        config:
          ignore_checks:
          - W2531
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: "index.handler"
      Runtime: "nodejs8.10"

When I run cfn-lint sample-template.yaml, I receive the following warning:

~/Documents/workspace/temp|
⇒  cfn-lint sample-template.yaml
W2531 EOL runtime (nodejs8.10) specified. Runtime is EOL since 2019-12-
31 and updating will be disabled at 2020-02-03, please consider to upda
te to nodejs10.x
sample-template.yaml:9:3
~/Documents/workspace/temp|
⇒  

When I un-comment the root-level Metadata, then the warning is gone:

Metadata:  # nodeJS8.10 EOL warning
  cfn-lint:
    config:
      ignore_checks:
      - W2531
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
  Lambda:
    Metadata:  # nodeJS8.10 EOL warning
      cfn-lint:
        config:
          ignore_checks:
          - W2531
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: "index.handler"
      Runtime: "nodejs8.10"
~/Documents/workspace/temp|
⇒  cfn-lint sample-template.yaml
~/Documents/workspace/temp|
⇒  

I have no other files in my dir:

~/Documents/workspace/temp|
⇒  tree .
.
└── sample-template.yaml

0 directories, 1 file
~/Documents/workspace/temp|
⇒  

It seems as though for W2531, cfn-lint does not process resource-based metadata, but it does process root-based metadata. I believe this is a bug.

I can provide more info on request.

Thank you!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tazatwellcommented, Jan 9, 2020

Hi, thanks for the update.

It makes sense that some metadata may be lost since we’re dealing with an AWS::Serverless::Function resource. And I’m also not sure how to go about including metadata since the resource is passed to aws-sam-translator. Resolving this will probably take time and careful consideration.

I made a quick PR to include info in the README about this here: #1297. Let me know if you feel that’s appropriate.

Thanks for the help and clarification 😃 since there’s already an existing issue, feel free to close this one.

1reaction
jlhoodcommented, Jan 9, 2020

Looks like there’s an existing issue for it. Added a comment there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::Serverless::Function ignores resource-based metadata ...
It seems as though for W2531 , cfn-lint does not process resource-based metadata, but it does process root-based metadata. I believe this is...
Read more >
Function - AWS Serverless Application Model
Building your application with necessary Metadata entries takes precedence over ImageUri , so if you specify both then ImageUri is ignored. Type: String....
Read more >
sam build - AWS Serverless Application Model
For serverless function resources that have the Image package type, use the Metadata resource attribute to configure Docker image settings that are required ......
Read more >
Conditions - AWS CloudFormation
Conditions are evaluated based on predefined pseudo parameters or input parameter ... Resources that are associated with a false condition are ignored.
Read more >
sam deploy - AWS Serverless Application Model
To deploy an AWS SAM application, use the sam deploy command from the AWS SAM CLI.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found