aws-cloudformation / cfn-lint

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

False Postive for E1011 for Missing Mapping Key when a DefaultValue of AWS::NoValue #3409

Closed georgealton closed 6 days ago

georgealton commented 6 days ago

CloudFormation Lint Version

cfn-lint 1.3.5

What operating system are you using?

Arch

Describe the bug

Extension to #3396 where E1011 was raised due to a Type Error.

This issue is that cfn-lint reports an E1011 because Key RoleName Doesn't exists Mapping, despite the presence of a DefaultValue.

Expected behavior

When using LanguageExtensions and a DefaultValue in a FindInMap the

Reproduction template

Mappings:
  Roles:
    A:
     Description: "Test"

Transform: AWS::LanguageExtensions

Resources:
  Role:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !FindInMap
        - Roles
        - A
        - RoleName
        - DefaultValue: !Ref AWS::NoValue
      Description: !FindInMap
        - Roles
        - A
        - Description
        - DefaultValue: !Ref AWS::NoValue
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Principal:
              AWS: '*'
            Effect: Allow
            Action: sts:AssumeRole
E1011 'RoleName' is not one of ['Description'] for mapping 'Roles' and key 'A'
E1011.cfn.yaml:15:11