Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(events-targets): replace custom resource with native grantWrite method for log group write permissions #30428

Closed

Conversation

frankpengau
Copy link
Contributor

Issue # (if applicable)

Closes #20855

Reason for this change

The custom resource lambda used to just add the log group resource policy seems like an unnecessary use of the lambda resource. It would be better to refactor it to use the native grantWrite method for CloudWatch Log Group to grant the write permissions necessary for eventbridge.

Description of changes

Remove custom cloudwatch log group rule target custom resource lambda to add write permissions and replace with grantWrite.

Similar to how sqs grants write permissions for eventbridge:

this.queue.grantSendMessages(new iam.ServicePrincipal('events.amazonaws.com', { conditions }));

Description of how you validated changes

Changed unit test, but might need some help to get the integration test to work

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team June 2, 2024 08:09
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Jun 2, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 6c9e13b
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@frankpengau frankpengau changed the title refactor(aws-events-targets): replace custom resource with native grantWrite method for log group write permissions refactor(events-targets): replace custom resource with native grantWrite method for log group write permissions Jun 2, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 2, 2024 08:25

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@TheRealAmazonKendra
Copy link
Contributor

This was used because a ResourcePolicy is needed here, which is what the grant function is creating under the hood. When this was first written, that resource wasn't available in all regions so we used a Custom Resource.

Unfortunately, providing a migration path to not using said custom resource isn't completely straight forward due to the onDelete function added here and because there is a limit of 10 resource policies allowed per region/account. If we try to add a new policy to perform a replacement, it might cause users to hit that limit and then the deployment will fail.

I'm actually working on this same issue for another package right now.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the BUILD FAILING state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@frankpengau
Copy link
Contributor Author

@TheRealAmazonKendra If you're working on this in another package and are able to also add in this package as well, that would be great! 🙏

Happy to close this PR off for now and wait for your changes to fix it for good.

@aws-cdk-automation
Copy link
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days 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.

events: log group target
3 participants