We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The cfn-lint rule WS1004 raises an exception if the property LogGroupName of an AWS::Logs::LogGroup is a Sub function with a variable map.
LogGroupName
AWS::Logs::LogGroup
Sub
The rule WS1004 should analyze LogGroupName properties without errors and match correct configured LogGroups to the lambda functions.
Rule WS1004 raises an exception: TypeError: expected string or bytes-like object
TypeError: expected string or bytes-like object
template.yml
Transform: AWS::Serverless-2016-10-31 Resources: MyFunction: Type: AWS::Serverless::Function Properties: Runtime: python3.8 Handler: index.handler MemorySize: 128 Timeout: 3 Tracing: Active CodePipelineNotificationLogGroup: Type: AWS::Logs::LogGroup UpdateReplacePolicy: Delete DeletionPolicy: Delete Properties: LogGroupName: !Sub - "/aws/lambda/${FunctionName}" - FunctionName: !Ref MyFunction RetentionInDays: 400
cfn-lint -a cfn_lint_serverless.rules -t template.yml
E0002 Unknown exception while processing rule WS1004: expected string or bytes-like object template.yml:1:1
The text was updated successfully, but these errors were encountered:
Hi @t2b !
Thanks for reporting this. I can confirm the bug and will push out a fix soon in version 0.1.9.
0.1.9
I'm also adding two new test cases to catch this:
Ref in a Sub:
AWSTemplateFormatVersion: "2010-09-09" Transform: "AWS::Serverless-2016-10-31" Resources: Function: Type: AWS::Serverless::Function Properties: CodeUri: . Runtime: python3.8 Handler: main.handler Tracing: Active LogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub - "/aws/lambda/${Fn}" - Fn: !Ref Function RetentionInDays: 7
Hard coded value in a Sub:
AWSTemplateFormatVersion: "2010-09-09" Transform: "AWS::Serverless-2016-10-31" Resources: Function: Type: AWS::Serverless::Function Properties: FunctionName: my-function-name CodeUri: . Runtime: python3.8 Handler: main.handler Tracing: Active LogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub - "/aws/lambda/${Fn}" - Fn: my-function-name RetentionInDays: 7
Sorry, something went wrong.
fix(cfnlint): support variables in Sub for WS1004, fixes #62
fe5b27f
d5fd9be
And there we go: version 0.1.9 is out with the bug fix. 😄 Thanks again for reporting the issue!
No branches or pull requests
The cfn-lint rule WS1004 raises an exception if the property
LogGroupName
of anAWS::Logs::LogGroup
is aSub
function with a variable map.Expected Behavior
The rule WS1004 should analyze
LogGroupName
properties without errors and match correct configured LogGroups to the lambda functions.Current Behavior
Rule WS1004 raises an exception:
TypeError: expected string or bytes-like object
Steps to Reproduce (for bugs)
template.yml
Environment
paste logs here
The text was updated successfully, but these errors were encountered: