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
197 stars 16 forks source link

Show account aliases or human-readable account names instead/alongside account ids #84

Open nitrocode opened 7 months ago

nitrocode commented 7 months ago

It would be nice to show the human readable account name (or account alias). One way we can do it is by providing a JSON mapping of account-id to account-name.

https://github.com/cloudandthings/terraform-aws-clickops-notifier/blob/be9694cda07dbe74fad9e332723be3b38bb5267b/clickopsnotifier/app.py#L251

https://github.com/cloudandthings/terraform-aws-clickops-notifier/blob/be9694cda07dbe74fad9e332723be3b38bb5267b/clickopsnotifier/app.py#L59-L63

https://github.com/cloudandthings/terraform-aws-clickops-notifier/blob/be9694cda07dbe74fad9e332723be3b38bb5267b/clickopsnotifier/messenger.py#L100-L104

Then we can add the following (provided that there is an account name for the account id)

     {
         "type": "mrkdwn",
         "text": f"*Account Name*\n{account_names[trail_event['recipientAccountId']}",
     },