Proposed Solution
When an existing Function is passed to subscribe(), instead of trying to modify its config and recreate it, we:
- Use the existing function as-is
- Create a new IAM Policy with the required permissions (SQS or DynamoDB stream)
- Attach that policy to the function's existing role
Possible problem
Trouble might be to determine if function does not already have necessary permissions. Ideally we'd check and not create them if already there. Practically it will work anyway I guess. Needs some testing to evaluate what to do.
Proposed Solution
When an existing
Functionis passed tosubscribe(), instead of trying to modify its config and recreate it, we:Possible problem
Trouble might be to determine if function does not already have necessary permissions. Ideally we'd check and not create them if already there. Practically it will work anyway I guess. Needs some testing to evaluate what to do.