-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
aws_s3: cyclic dependency introduced for cross-stack bucket use #23701
Comments
I believe this was fixed in #23552 which should be included in the next release of the CDK. And as suggested, that does include test cases for the cross-stack references, so hopefully this doesn't regress again! |
The specific issue was that the Bucket Policy of the imported target log bucket depended on attributes of the current stack’s bucket (the account and its ARN); and that bucket then depended on the target log bucket (to configure log delivery) |
@kylelaker Thanks for the heads up! Good to know, was still digging into the code, but not too familiar with aws-cdk's codebase yet, so figured I at least report it. Hadn't checked the latest commits though. |
@ashemedai I think the necessary fix landed in v2.61.0, which was released very recently. Would you mind giving that a try and seeing if it resolves your issue? |
@kylelaker Just ran my set up and it works as it should with 2.61.0. Thanks! |
|
Describe the bug
I think PR #23386 (2.59.0+) inadvertently introduced a cyclic dependency for cross-stack use of S3 buckets. Using the suggested way for cross-stack bucket use, as per this link, results in
cdk synth
failing with a cyclic reference error.Using the same set up with 2.58.1 does not cause any cyclic reference problems.
Expected Behavior
Shared stack with central access logs S3 bucket created for use in other stacks. Other stack(s) then can be created and depend on said stack and refer to the appropriate bucket in their own
serverAccessLogsBucket
configuration for writing their access logs to. A not uncommon scenario, I would think.Current Behavior
Dependent stacks are being added as a dependency to the original stack, causing a cyclic dependency.
Reproduction Steps
bin/s3-cycle.ts
lib/s3-shared-stack.ts
lib/s3-cycle-stack.ts
Possible Solution
Unsure right now, still trying to figure out what is actually being made dependent.
Additional Information/Context
When test cases are added, it makes sense to add cross-stack tests as well. Not just the happy path all-in-one-stack tests.
CDK CLI Version
2.59.0 (build b24095d)
Framework Version
2.59.0
Node.js Version
Node.js v18.12.1
OS
Ubuntu 22.04.1 LTS
Language
Typescript
Language Version
TypeScript 4.9.4
Other information
PR #23386 as mentioned earlier.
The text was updated successfully, but these errors were encountered: