rules:
- id: aws-elb-access-logs-not-enabled
  patterns:
  - pattern-either:
    - pattern: |
        resource "aws_lb" $ANYTHING {
          ...
        }
    - pattern: |
        resource "aws_alb" $ANYTHING {
          ...
        }
  - pattern-not-inside: |
      resource $ANYLB $ANYTHING {
        ...
        access_logs {
          ...
          enabled = true
          ...
        }
        ...
      }
  - pattern-not-inside: |
      resource $ANYLB $ANYTHING {
        ...
        subnet_mapping {
          ...
        }
        ...
      } 
  message: ELB has no logging. Missing logs can cause missing important event information.
  languages: [hcl]
  severity: WARNING
  metadata:
    owasp:
    - A03:2017 - Sensitive Data Exposure
    - A02:2021 - Cryptographic Failures
    cwe:
    - 'CWE-326: Inadequate Encryption Strength'
    technology:
    - aws
    - terraform
    category: security
    references:
    - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
    subcategory:
    - audit
    likelihood: LOW
    impact: LOW
    confidence: LOW
