getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
912 stars 111 forks source link

Allow Queue construct to perform action sqs:ChangeMessageVisibility #300

Closed martindanielsson closed 1 year ago

martindanielsson commented 1 year ago

Start from the Use-case

I want to be able to release a job back to a SQS queue, to be attempted in X time, from the job handling lambda. This requires the sqs permission: SQS:ChangeMessageVisibility

Example Config

No response

Implementation Idea

Could be fixed by adding the permission to src/constructs/aws/Queue.ts

    permissions(): PolicyStatement[] {
        return [new PolicyStatement(["sqs:SendMessage", "sqs:ChangeMessageVisibility"], [this.queue.queueArn])];
    }
mnapoli commented 1 year ago

Makes sense to me (this permission is part of the "usage" of SQS), interesting that nobody brought that up before. @fredericbarthelet wdyt?

fredericbarthelet commented 1 year ago

Agreed, let's merge that in :) Thanks @martindanielsson for reporting the issue