cloudandthings / terraform-aws-clickops-notifier

Get notified when actions are taken in the AWS Console.
https://registry.terraform.io/modules/cloudandthings/clickops-notifier/aws/latest
MIT License
208 stars 17 forks source link

fix: Ensure trail_event_origin is constructed from strings #63

Closed scott-the-programmer closed 1 year ago

scott-the-programmer commented 1 year ago

Hello! Currently looking at trying out this project to reduce clickops 😄

Ran into an error when running the example in standalone mode

[ERROR] TypeError: can only concatenate str (not "set") to str
Traceback (most recent call last):
  File "/var/task/app.py", line 199, in handler_standalone
    event_json["logGroup"]

This appears to be due to the concatenation of trail_event_origin being a mix of strings and sets. The message payload looks something like this

  ...
  "logGroup": "some_group",
  "logStream": "some_stream",
  "subscriptionFilters": ["some_filter"],
  "logEvents": [
    {
     ...
    }
   ]

Instead - i think the concatination should look something like

     trail_event_origin = (
            event_json["logGroup"]
            + ":"
            + event_json["logStream"]
            + "\n"
            + ":".join(event_json["subscriptionFilters"])
        )

I've manually the change on my test account and it seems to be working OK 😄

Thanks!

baolsen commented 1 year ago

LGTM, thanks for the contribution!