fivexl / terraform-aws-cloudtrail-to-slack

Parse AWS CloudTrail events and send alerts to Slack for events that match pre-configured rules
https://registry.terraform.io/modules/fivexl/cloudtrail-to-slack/aws/latest
Apache License 2.0
93 stars 26 forks source link

Getting error if events_to_track parameter is not set. #20

Closed zhelezovartem closed 2 years ago

zhelezovartem commented 2 years ago

Terraform code (events_to_track parameter is not set):

module "cloudtrail_to_slack" {
  source                               = "fivexl/cloudtrail-to-slack/aws"
  version                              = "2.3.0"
  default_slack_hook_url               = nonsensitive(data.aws_ssm_parameter.hook.value)
  cloudtrail_logs_s3_bucket_name       = module.cloudtrail_bucket.s3_bucket_id
  tags                                 = module.tags.result
}

Getting error message:

Event parsing failed: <class 'SyntaxError'>.

[ERROR] SyntaxError: unexpected EOF while parsing (<string>, line 0)
Traceback (most recent call last):
  File "/var/task/main.py", line 128, in lambda_handler
    handle_event(log_event, record['key'], rules, ignore_rules, hook_url)
  File "/var/task/main.py", line 158, in handle_event
    if should_message_be_processed(event, rules, ignore_rules) is not True:
  File "/var/task/main.py", line 140, in should_message_be_processed
    if eval(rule, 
{}
, {'event': flat_event}) is True:
Andrey9kin commented 2 years ago

@zhelezovartem i believe something like this got fixed in 2.3.1. Could you please try the latest? ( 2.3.2)

zhelezovartem commented 2 years ago

@Andrey9kin yes, 2.3.2 works fine, thank you!