-
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(redshift): deploy fails when creating logging bucket without s3 key #21243
fix(redshift): deploy fails when creating logging bucket without s3 key #21243
Conversation
Can you clarify for me if the issue here is that he CFN documentation is incorrect and the prefix key is, indeed, required by them? Or is this our logic that makes it necessary despite it being an optional prop? |
I believe this field is required when adding a logging bucket as I tested the following:
Without logging prefix:
With logging prefix:
|
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.
Thank you for your contribution! Please see my comment below. While this works, I think improving the contract is a better approach.
@@ -474,6 +474,10 @@ export class Cluster extends ClusterBase { | |||
this.singleUserRotationApplication = secretsmanager.SecretRotationApplication.REDSHIFT_ROTATION_SINGLE_USER; | |||
this.multiUserRotationApplication = secretsmanager.SecretRotationApplication.REDSHIFT_ROTATION_MULTI_USER; | |||
|
|||
if (props.loggingBucket && !props.loggingKeyPrefix) { |
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.
If these props need to be both or neither, I'd prefer we take loggingBucket
and loggingKeyPrefix
and make them into an interface that is optional, with both fields being required. I recognize that this is a breaking change, but I think it's the better contract overall. Since this is an experimental module, we can do this without a feature flag.
Pull request has been modified.
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.
The fact that this change didn't break any integration tests tells me we have a testing coverage gap. Please add an integration test with these properties set.
There was already an integration test with both the logging bucket and prefix set, so this change meant that this test had the syntax altered to use the new interface. Does this need another test setting the logging bucket and prefix? |
Can you point me in the direction of this integ test? This change in contract should have broken it. Note that the integ test file names start with |
You're absolutely right. I misunderstood the difference between integ tests and regular tests! I've tried to create a new integ test but it fails on execution as to create a logging bucket Redshift needs to have a role that allows it to s3:GetBucketAcl and s3:PutObject.
When creating a cluster with a logging bucket should we also create a new IAM role and attach these permissions to it by default? CFN error:
Redshift documentation: https://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-manage-log-files |
Pull request has been modified.
Yep, we definitely want to attach the role/policy that will allow this to deploy successfully. This is one of those perfect examples of what we only catch in integ tests and not in unit tests. Thanks for adding it so we could find the gap now instead of having a bug later! |
This looks great, btw. Once those permissions get added and the tests are updated to include them, I think this is ready to go |
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.
Just putting this back in changes requested so I get the alert when new changes have been made.
Pull request has been modified.
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 for all your work on this!
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). |
…ey (aws#21243) To send these Amazon Redshift logging information about connections and user activities in your database to an S3 bucket, specify an S3 bucket and prefix using an interface. CFN documentation has S3KeyPrefix as optional, but testing has shown that key is required and CFN error (same as in below issue) will be thrown when key is not provided. closes: aws#19514. BREAKING CHANGE: The way to specify a logging bucket and prefix will change to use an interface. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-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*
…ey (aws#21243) To send these Amazon Redshift logging information about connections and user activities in your database to an S3 bucket, specify an S3 bucket and prefix using an interface. CFN documentation has S3KeyPrefix as optional, but testing has shown that key is required and CFN error (same as in below issue) will be thrown when key is not provided. closes: aws#19514. BREAKING CHANGE: The way to specify a logging bucket and prefix will change to use an interface. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-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*
To send these Amazon Redshift logging information about connections and user activities in your database to an S3 bucket, specify an S3 bucket and prefix using an interface.
CFN documentation has S3KeyPrefix as optional, but testing has shown that key is required and CFN error (same as in below issue) will be thrown when key is not provided.
closes: #19514.
BREAKING CHANGE: The way to specify a logging bucket and prefix will change to use an interface.
All Submissions:
Adding new Unconventional Dependencies:
New Features
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