rules:
- id: aws-redshift-cluster-encrypted-with-cmk
  patterns:
  - pattern: |
      resource "aws_redshift_cluster" $ANYTHING {
        ...
      }
  - pattern-not-inside: |
      resource "aws_redshift_cluster" $ANYTHING {
        ...
        kms_key_id = ...
        ...
      }
  message: >-
    Ensure AWS Redshift cluster is encrypted at rest using KMS CMKs. CMKs gives you control over the encryption
    key in terms of access and rotation.
  metadata:
    category: security
    technology:
    - terraform
    - aws
    owasp:
    - A05:2017 - Broken Access Control
    - A01:2021 - Broken Access Control
    cwe:
    - 'CWE-284: Improper Access Control'
    references:
    - https://owasp.org/Top10/A01_2021-Broken_Access_Control
    subcategory:
    - audit
    likelihood: LOW
    impact: LOW
    confidence: LOW
  languages: [hcl]
  severity: WARNING
