Skip to content

feat(sqs): support for permission settings for dead letter source queues#28745

Merged
mergify[bot] merged 24 commits intoaws:mainfrom
badmintoncryer:19766-redriveAllowPolicy
Jan 29, 2024
Merged

feat(sqs): support for permission settings for dead letter source queues#28745
mergify[bot] merged 24 commits intoaws:mainfrom
badmintoncryer:19766-redriveAllowPolicy

Conversation

@badmintoncryer
Copy link
Copy Markdown
Contributor

@badmintoncryer badmintoncryer commented Jan 17, 2024

This PR allows for the configuration of constraints on source queues that can designate this queue as their dead letter queue.

declare const sourceQueue: sqs.IQueue;

// Only the sourceQueue can specify this queue as the dead-letter queue.
const queue1 = new sqs.Queue(this, 'Queue1', {
  redriveAllowPolicy: {
    sourceQueues: [sourceQueue],
  }
});

// No source queues can specify this queue as the dead-letter queue.
const queue2 = new sqs.Queue(this, 'Queue2', {
  redriveAllowPolicy: {
    redrivePermission: sqs.RedrivePermission.DENY_ALL,
  }
});

Closes #19766.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the admired-contributor [Pilot] contributed between 13-24 PRs to the CDK label Jan 17, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team January 17, 2024 18:32
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Jan 17, 2024
@badmintoncryer badmintoncryer changed the title feat(sqs): support for permission settings for DLQ source queues feat(sqs): support for permission settings for dead letter source queues Jan 17, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 18, 2024
Copy link
Copy Markdown
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍
I left some notes for minor adjustments.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 18, 2024
@badmintoncryer
Copy link
Copy Markdown
Contributor Author

badmintoncryer commented Jan 18, 2024

@lpizzinidev Thank you for your review! I addressed your comments.

Copy link
Copy Markdown
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying 👍
The implementation of the deadLetterQueue property is pretty old and I think we should stick to the CloudFormation definition when possible for new props to avoid confusion.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 20, 2024
@badmintoncryer
Copy link
Copy Markdown
Contributor Author

Thank you for the confirmation. And I understand the policy on naming as well.

}
: undefined;

const redriveAllowPolicy = props.redriveAllowPolicy ? {
Copy link
Copy Markdown
Member

@GavinZZ GavinZZ Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood this logic from reading the docs trings above, but in general this ternary condition is quite confusing for people who look at this piece of code for the first time. Would be nice to have a comment here explaining it (i.e. when sourcePolicy is provided, default to use allow all permission ...).

Fairly minor change, and I'm happy to approve this PR.

@badmintoncryer
Copy link
Copy Markdown
Contributor Author

@GavinZZ I've updated comments. Please confirm it again.

@GavinZZ
Copy link
Copy Markdown
Member

GavinZZ commented Jan 28, 2024

Thank you for the contribution! Happy to approve once the CI passes.

@badmintoncryer
Copy link
Copy Markdown
Contributor Author

@GavinZZ Do you know why the CI has failed?? https://github.com/aws/aws-cdk/actions/runs/7680150613/job/20931832477?pr=28745

This problem seems to have occurred in other PRs as well.

Run ./tools/@aws-cdk/prlint
  env:
    GITHUB_TOKEN: ***
    PR_NUMBER: 
    PR_SHA: 
    REPO_ROOT: /home/runner/work/aws-cdk/aws-cdk
⌛  Fetching PR number [2](https://github.com/aws/aws-cdk/actions/runs/7680150613/job/20931832477?pr=28745#step:4:2)87[4](https://github.com/aws/aws-cdk/actions/runs/7680150613/job/20931832477?pr=28745#step:4:4)[5](https://github.com/aws/aws-cdk/actions/runs/7680150613/job/20931832477?pr=28745#step:4:5)
Error: Bad credentials

@badmintoncryer
Copy link
Copy Markdown
Contributor Author

@GavinZZ
The above problem seems to be resolved. However, the CodeBuild job status remains 'pending' even though it has finished successfully. How can I resolve it ?

@GavinZZ
Copy link
Copy Markdown
Member

GavinZZ commented Jan 29, 2024

We're actively working on a fix on this issue. Sorry for the inconvenience.

@GavinZZ
Copy link
Copy Markdown
Member

GavinZZ commented Jan 29, 2024

@mergify update

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 2024

update

✅ Branch has been successfully updated

Copy link
Copy Markdown
Member

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for contributing!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 29, 2024
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: af747d4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 9e21803 into aws:main Jan 29, 2024
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 29, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Vandita2020 pushed a commit to Vandita2020/aws-cdk that referenced this pull request Jan 30, 2024
…ues (aws#28745)

This PR allows for the configuration of constraints on source queues that can designate this queue as their dead letter queue.

```ts
declare const sourceQueue: sqs.IQueue;

// Only the sourceQueue can specify this queue as the dead-letter queue.
const queue1 = new sqs.Queue(this, 'Queue1', {
  redriveAllowPolicy: {
    sourceQueues: [sourceQueue],
  }
});

// No source queues can specify this queue as the dead-letter queue.
const queue2 = new sqs.Queue(this, 'Queue2', {
  redriveAllowPolicy: {
    redrivePermission: sqs.RedrivePermission.DENY_ALL,
  }
});
```

Closes aws#19766.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
SankyRed pushed a commit that referenced this pull request Feb 8, 2024
…ues (#28745)

This PR allows for the configuration of constraints on source queues that can designate this queue as their dead letter queue.

```ts
declare const sourceQueue: sqs.IQueue;

// Only the sourceQueue can specify this queue as the dead-letter queue.
const queue1 = new sqs.Queue(this, 'Queue1', {
  redriveAllowPolicy: {
    sourceQueues: [sourceQueue],
  }
});

// No source queues can specify this queue as the dead-letter queue.
const queue2 = new sqs.Queue(this, 'Queue2', {
  redriveAllowPolicy: {
    redrivePermission: sqs.RedrivePermission.DENY_ALL,
  }
});
```

Closes #19766.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admired-contributor [Pilot] contributed between 13-24 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add suport for RedriveAllowPolicy in the Queue construct

4 participants