-
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
fix(event-targets): circular dependency when the lambda target is in a different stack #11217
Conversation
…a different stack The Lambda Permission resource causes a cyclic dependency when the rule is in a seprate stack from the lambda target for the rule. (a picture is worth a thousand words) ``` +-------------------+ +---------------+ |Lamda Stack | |Event Stack | | | | | | +----------+ | | +------+ | | | | | | | | | | | Function |<-----------------+ Rule | | | | | | | | | | | +----------+ | | +------+ | | ^ | | ^ | | | | | | | | +-----+------+ | | | | | | | | | | | | | Permission +--------------------+ | | | | | | | | +------------+ | | | | | | | +-------------------+ +---------------+ ``` The fix is to move the Permission resource into the event stack instead. fixes #10942
expect(stack).toCountResources('AWS::Lambda::Permission', 1); | ||
}); | ||
|
||
test('lambda handler and cloudwatch event across stacks', () => { |
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.
Should there also be a test for an imported Rule, as that changes the behavior?
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.
Why is this any different for imported Rule? Imported Rules also follow the same logic.
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.
Ah, nevermind. I thought the if (rule instanceof Construct) {
was a check against imported rules. But I see that's not the case.
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.
Imported resources are also a Construct
. They inherit Resource
which is a subclass of Construct
.
The if
statement is needed because IRule
and Construct
don't overlap. But so far there is no case when the Rule will not be a Construct
.
Thank you for contributing! Your pull request will be updated from master 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 master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
The Lambda Permission resource causes a cyclic dependency when the rule
is in a seprate stack from the lambda target for the rule.
(a picture is worth a thousand words)
The fix is to move the Permission resource into the event stack instead.
fixes #10942
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license