-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(events): add multiple event bus policies on a single event bus #27340
Conversation
7f4bdea
to
0b1f83c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👍
A couple of changes are needed in my opinion.
Note (for maintainers)
Looks to me like adding a policy with multiple statements to an event bus is acceptable.
But, this behavior is not reflected in the CloudFormation definition.
The fix proposed in this PR is a workaround that creates multiple policies for the same event bus.
The ideal solution would probably be to adapt the CloudFormation template declaration to accept multiple statements and then change the CDK implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks 👍
But higher-level evaluation could be necessary.
5e9f8ab
to
a560960
Compare
+1 (meant to do it on the issue my apologies) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the best we're going to get, so I don't mind adding this in. It's not really a hack to just specify more EventBusPolicy
resources, we do this elsewhere though I can't come up with an example off the top of my head.
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
#27340 introduced the ability to create multiple event bus policies on a single event bus. To facilitate this, the logical Id was changed from `"Policy"` to the statementId. This triggers a replacement, which fails in CloudFormation because the statement ID does not change. The idea behind this PR is simple -- we are updating the statement ID of the policy to trigger a change for anyone who updates to the new version. I think we are okay with this change because no one should be depending on the statementIds of their policies. And since the policy is not a stateful resource, updating the policy should not harm anyone. I have checked the feasibility of this PR on my own, hence the lack of an integ test. closes #28520 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
aws#27340 introduced the ability to create multiple event bus policies on a single event bus. To facilitate this, the logical Id was changed from `"Policy"` to the statementId. This triggers a replacement, which fails in CloudFormation because the statement ID does not change. The idea behind this PR is simple -- we are updating the statement ID of the policy to trigger a change for anyone who updates to the new version. I think we are okay with this change because no one should be depending on the statementIds of their policies. And since the policy is not a stateful resource, updating the policy should not harm anyone. I have checked the feasibility of this PR on my own, hence the lack of an integ test. closes aws#28520 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Enable the creation of multiple event bus policies on a single event bus.
Closes #24671.
The result of the Policies created by the integration test is a resource policy on the event bus that looks like
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license