Skip to content

[cfn-lint] WS1004 incorrectly reported #190

@shawnbucholtz

Description

@shawnbucholtz

What were you trying to accomplish?

Resolve warnings. See aws-cloudformation/cfn-lint#3103

cfn-lint incorrectly reports:

[cfn-lint] WS1004: Lambda function xxx does not have a corresponding log group with a Retention property

Expected Behavior

When there is an explicit !Ref to a defined log group with the RetentionInDays property set then WS1004 should not be flagged, unless I am misunderstanding the warning.

Current Behavior

Warning about WS1004 despite having a log group with a retention property referenced.

Possible Solution

Manual solution is adding .cfnlintrc.yaml to ignore the warning.

Steps to Reproduce (for bugs)

Run cfn-lint with the serverless template below:

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31

Resources:

  LambdaProxyFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/
      FunctionName: MyFunction
      Handler: index.handler
      LoggingConfig:
        LogFormat: JSON
        LogGroup: !Ref LambdaProxyLogGroup
      MemorySize: 512
      PackageType: Zip
      ReservedConcurrentExecutions: 1
      Runtime: nodejs18.x
      Timeout: 10
      Tracing: Active

  LambdaProxyLogGroup:
    DeletionPolicy: Retain
    UpdateReplacePolicy: Retain
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupClass: STANDARD
      RetentionInDays: 180

Environment

Python 3.8.10
cfn-lint 0.86.0
cfn-lint-serverless 0.3.2

Log to large to paste, attached instead.

out.log

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions