Skip to content

Commit

Permalink
Using wrong token for policy name
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave North committed Sep 28, 2017
1 parent 94e55e0 commit 6c979cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lambda/iam-notify-slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c979cf

Please sign in to comment.