Note: this is no longer required, CloudFormation now directly supports the Lambda AddPermission api call: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html
Lambda custom function to add permissions to a Lambda function in CloudFormation.
sns_add_permissions.json - SNS Topic event source s3_add_permissions.json - S3 Bucket event source