awslabs / awslabs/serverless-rules

[cfn-lint] WS1004 incorrectly reported

Open
#190 1 comment 1 reaction 1 assignee Claimed by @sliedig View on GitHub
area/cfn-lint bug
Dominant language
Go
Stars
420
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**What were you trying to accomplish?**

Resolve warnings. See https://github.com/aws-cloudformation/cfn-lint/issues/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:

```yaml
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](https://github.com/awslabs/serverless-rules/files/14676057/out.log)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.