Open peter-kasa opened 7 months ago
We ran into the issue of having a too large IAM role generated when using multiple snsSqs events in one serverless.yml. (An other PR also related to this issue: https://github.com/agiledigital/serverless-sns-sqs-lambda/pull/715)
I noticed that the generated IAM role's size can be reduced by merging multiple policy statements into one. The scope of this PR is to do this resource merge. See the before/after example on what to expect.
{ "Version": "2012-10-17", "Statement": [ ... { "Action": [ "sqs:DeleteMessage", "sqs:GetQueueAttributes", "sqs:ReceiveMessage" ], "Resource": [ "arn:aws:sqs:us-west-2:123456789000:test-dev-testQueue", "arn:aws:sqs:us-west-2:123456789000:test-dev-testDeadLetterQueue" ], "Effect": "Allow" }, { "Action": [ "sqs:DeleteMessage", "sqs:GetQueueAttributes", "sqs:ReceiveMessage" ], "Resource": [ "arn:aws:sqs:us-west-2:123456789000:test-dev-test2Queue", "arn:aws:sqs:us-west-2:123456789000:test-dev-test2DeadLetterQueue" ], "Effect": "Allow" } ... ] }
{ "Version": "2012-10-17", "Statement": [ ... { "Action": [ "sqs:DeleteMessage", "sqs:GetQueueAttributes", "sqs:ReceiveMessage" ], "Resource": [ "arn:aws:sqs:us-west-2:123456789000:test-dev-testQueue", "arn:aws:sqs:us-west-2:123456789000:test-dev-testDeadLetterQueue", "arn:aws:sqs:us-west-2:123456789000:test-dev-test2Queue", "arn:aws:sqs:us-west-2:123456789000:test-dev-test2DeadLetterQueue" ], "Effect": "Allow" } ... ] }
We ran into the issue of having a too large IAM role generated when using multiple snsSqs events in one serverless.yml. (An other PR also related to this issue: https://github.com/agiledigital/serverless-sns-sqs-lambda/pull/715)
I noticed that the generated IAM role's size can be reduced by merging multiple policy statements into one. The scope of this PR is to do this resource merge. See the before/after example on what to expect.
Example
Before
After