aws-cloudformation / cfn-lint

CloudFormation Linter
MIT No Attribution
2.4k stars 576 forks source link

E3011 'awslogs-create-group' is not one of ['awslogs-datetime-format', 'awslogs-group', 'awslogs-multiline-pattern', 'awslogs-region', 'awslogs-stream-prefix', 'max-buffer-size', 'mode'] #3360

Closed jakewaggoner closed 2 weeks ago

jakewaggoner commented 2 weeks ago

CloudFormation Lint Version

1.3.1

What operating system are you using?

Mac

Describe the bug

The error

E3011 'awslogs-create-group' is not one of ['awslogs-datetime-format', 'awslogs-group', 'awslogs-multiline-pattern', 'awslogs-region', 'awslogs-stream-prefix', 'max-buffer-size', 'mode']

is produced on a valid ECS task defintion. I have provided an example below.

Expected behavior

This error should not happen as the template is valid. You can see from an AWS example here that the option awslogs-create-group is valid. Its true that this is not a recommended approach, at least according the AWS Batch docs, however if thats considered then this should be treated as a warning at most.

Reproduction template

AWSTemplateFormatVersion: "2010-09-09"

Resources:
  TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      Family: "MyService"
      Cpu: 256
      Memory: 512
      NetworkMode: awsvpc
      RequiresCompatibilities:
        - FARGATE
      ContainerDefinitions:
        - Name: "MyService"
          Image:
            !Join
            - ""
            - - !Ref AWS::AccountId
              - .dkr.ecr.
              - !Ref AWS::Region
              - .amazonaws.com/
              - "MyRepo"
              - ":"
              - "20240620"
          PortMappings:
            - ContainerPort: 3000
          LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-create-group: "true"
              awslogs-region: !Ref AWS::Region
              awslogs-group: "MyLogGroup"
              awslogs-stream-prefix: "MyService"
          Environment:
            - Name: NODE_ENV
              Value: production