-
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
cdk: Breaking change to S3 bucket server access logging (v2.59.0) #23547
Comments
We did recently make changes to this in aws-cdk/packages/@aws-cdk/aws-s3/lib/bucket.ts Lines 1695 to 1697 in 8a5eb49
aws-cdk/packages/@aws-cdk/aws-s3/lib/bucket.ts Lines 2045 to 2051 in 8a5eb49
So, I'm curious how you were able to succeed at all with this in |
@peterwoodworth I have also tested this on Python with v2.8.0 of the library and v2.8.0 of the CLI and I get the same error as shown for v2.59.0. This code has been in the CDK since v1.21.0 in #5072. I am wondering if there's an issue with the This is purely an assumption based on #19448, #20564, and #15580. But The So to list this out, I think this is because:
I will open a PR to fix the |
I see the error in my reporting. The affected bucket is indeed applying I saw mention of a possible duplication of installed CDK versions, however I can verify that our build system is installing CDK at build time. CodeBuild is being used, so the environment is guaranteed to not be caching additional versions. |
I removed the property I leave it up to your team to decide how to proceed with the difference in behavior when this property is present. |
We are having a similar error here. We are setting up both of the following properties:
Our Access logs bucket is a separate bucket. However, CDK behaviour is adding ACLs to enable log delivery to the current bucket. The same happens when setting the feature flag The expected behaviour is that if It started happening when we upgraded from |
The problem seems to be in this logic here https://github.com/aws/aws-cdk/pull/23386/files#diff-97a6344bb43117c16441333d96eede412c2c7f7df034f88bbebb90b151eca42dR1835 introduced in the PR you mentioned @peterwoodworth
I think the fix here would be something like this:
|
Hi @andresionek91! That is almost exactly the fix implemented in #23552. There's an additional fix in that PR as well for other import scenarios (and tests added to hopefully avoid future regressions). Hopefully it gets reviewed by the CDK team soon |
Great news! Thanks a lot! |
…ucket is imported (#23552) This resolves issues with log delivery for situations where the target bucket for S3 Access Logs is in another stack. This situation was previously missing from unit and integration tests. This adds additional checks to make sure that this behavior works. There are two primary issues here: 1. Regardless of `@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy`, if the target bucket was imported (not a concrete `Bucket`), the grant would be applied to the _source_ bucket for logs improperly. This resulted in the ACL or Bucket Policy being added to the wrong stack. 2. When `@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy` was _enabled_ the created bucket policy resulted in a cyclical dependency because of the conditions; these conditions are not necessary for successful delivery. This omits them unless the bucket is concrete and in the same stack. Unit tests and integration tests now cover importing a bucket between stacks. Closes: #23547 Closes: #23588 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the bug
The latest release (v2.59.0) caused a breaking change within our CDK app for already existing buckets with server access logging enabled. The buckets are using a shared bucket as a target for logs. In version v2.8.0, this caused no issue when deploying with CDK. However, since this release our CDK deployment fails early with the following error:
RuntimeError: Cannot enable log delivery to this bucket because the bucket's ACL has been set and can't be changed
Expected Behavior
In v2.8.0, a CDK deployment with the provided bucket properties will not fail deployment. We observed ACLs not impacting an ability of the source bucket to write logs to the server access log target bucket.
Current Behavior
Deployment of the app fails with the error:
Reproduction Steps
Here is the definition of our target access logs bucket:
And this is the definition of the bucket failing the deployment:
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
v2.45.0
Framework Version
2.59.0
Node.js Version
16.13.0
OS
Windows
Language
Python
Language Version
3.8.0
Other information
No response
The text was updated successfully, but these errors were encountered: