From 6c979cf8360c806c1423202490eac5b2c540f141 Mon Sep 17 00:00:00 2001 From: Dave North Date: Thu, 28 Sep 2017 10:28:37 -0400 Subject: [PATCH] Using wrong token for policy name --- lambda/iam-notify-slack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lambda/iam-notify-slack.py b/lambda/iam-notify-slack.py index aa1ac3f..6877ca7 100644 --- a/lambda/iam-notify-slack.py +++ b/lambda/iam-notify-slack.py @@ -59,25 +59,25 @@ def lambda_handler(event, context): post_to_slack = True object_field_name = "" object_field_value = "" - policy_name = event['detail']['requestParameters']['policyArn'].split(':')[4] + policy_name = event['detail']['requestParameters']['policyArn'].split(':')[5] policy_arn = event['detail']['requestParameters']['policyArn'] elif event_name == "AttachGroupPolicy" or event_name == "DetachGroupPolicy": post_to_slack = True object_field_name = "Group" object_field_value = event['detail']['requestParameters']['groupName'] - policy_name = event['detail']['requestParameters']['policyArn'].split(':')[4] + policy_name = event['detail']['requestParameters']['policyArn'].split(':')[5] policy_arn = event['detail']['requestParameters']['policyArn'] elif event_name == "AttachUserPolicy" or event_name == "DetachUserPolicy": post_to_slack = True object_field_name = "User" object_field_value = event['detail']['requestParameters']['userName'] - policy_name = event['detail']['requestParameters']['policyArn'].split(':')[4] + policy_name = event['detail']['requestParameters']['policyArn'].split(':')[5] policy_arn = event['detail']['requestParameters']['policyArn'] elif event_name == "AttachRolePolicy" or event_name == "DetachRolePolicy": post_to_slack = True object_field_name = "Role" object_field_value = event['detail']['requestParameters']['roleName'] - policy_name = event['detail']['requestParameters']['policyArn'].split(':')[4] + policy_name = event['detail']['requestParameters']['policyArn'].split(':')[5] policy_arn = event['detail']['requestParameters']['policyArn'] else: print "No support for event " + event_name