rules:
- id: aws-config-aggregator-not-all-regions
  pattern-either:
  - pattern: |
      resource "aws_config_configuration_aggregator" $ANYTHING {
        ...
        account_aggregation_source {
          ...
          regions = ...
          ...
        }
        ...
      }
  - pattern: |
      resource "aws_config_configuration_aggregator" $ANYTHING {
        ...
        organization_aggregation_source {
          ...
          regions = ...
          ...
        }
        ...
      }
  message: The AWS configuration aggregator does not aggregate all AWS Config region.
    This may result in unmonitored configuration in regions that are thought to be
    unused. Configure the aggregator with all_regions for the source.
  languages:
  - hcl
  severity: WARNING
  metadata:
    category: security
    technology:
    - terraform
    - aws
    owasp:
    - A09:2021 - Security Logging and Monitoring Failures
    cwe:
    - 'CWE-778: Insufficient Logging'
    references:
    - https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/
    subcategory:
    - audit
    likelihood: LOW
    impact: MEDIUM
    confidence: HIGH
