-
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
RDS: DatabaseClusterFromSnapshot
should allow setting copyTagsToSnapshot
#19884
Comments
Thanks for opening the issue @blimmer! But I wonder: does this setting make sense on Thanks, |
@skinny85 I believe so, yes! The new |
DatabaseClusterFromSnapshot
should allow setting copyTagsToSnapshot
Yep, that sounds like how I would think about solving it, too. |
We encourage community contributions, so if you'd like to open us a Pull Request adding this feature, that would be fantastic! 😉 Our "Contributing" guide: https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md. |
Hi, I would like to pick this change and help in implementing it, will open a PR with the solution soon. Let me know in case of any concerns. |
…shot` property (#19932) This change will now allow users to set `copyTagsToSnapshot` attribute for the `DatabaseClusterFromSnapshot`. This will now be consistent with the way the database instance works. _Integration test may not be possible since this requires a valid snapshot to pre-exist before building the CDK stack to generate the CDK local snapshot._ _It might be possible to add a snapshot first by creating a new DB Cluster taking a manual snapshot then using that in `DatabaseClusterFromSnapshot` but it will become a hassle for anyone else in future to maintain or update since they will always need to proceed in the same manner to get the exact snapshot._ _An integration test for `copyTagsToSnapshot` already exists for `DatabaseCluster` in `integ.cluster.js` which is passing successfully on executing the tests._ Closes #19884 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/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/master/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
Today, the
copyTagsToSnapshot
property exists onDatabaseClusterProps
notDatabaseClusterBaseProps
:aws-cdk/packages/@aws-cdk/aws-rds/lib/cluster.ts
Lines 497 to 511 in 789e8d2
It's also not set in the
DatabaseClusterFromSnapshot
construct, so if you switch aDatabaseCluster
toDatabaseClusterFromSnapshot
, you'll get this diff:This is especially noticeable because the value defaults to
true
in the L2 construct, which is different from the CloudFormation default (false
):aws-cdk/packages/@aws-cdk/aws-rds/lib/cluster.ts
Lines 505 to 510 in 789e8d2
Unlike other values that are explicitly unset when using
DatabaseClusterFromSnapshot
(e.g.,KmsKeyId
,MasterUsername
,MasterUserPassword
- see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-kmskeyid), the docs forCopyTagsToSnapshot
don't specify that you shouldn't set the value when restoring from a snapshot.Expected Behavior
I expected to be able to switch from a
DatabaseCluster
to aDatabaseClusterFromSnapshot
while retaining the same default behaviors.Current Behavior
Currently, the
CopyTagsToSnapshot
value shows as being unset (which will change to the CloudFormation default offalse
) when changing from aDatabaseCluster
toDatabaseClusterFromSnapshot
.Reproduction Steps
https://github.com/blimmer/cdk-bug-reports/compare/rds-copy-tags-to-snapshot?expand=1
In this simple stack:
The resource with the id
DatabaseCluster
hasCopyTagsToSnapshot
set totrue
(the default in the L2 construct):However, the one restored from the snapshot does not have this value set:
Possible Solution
I think
copyTagsToSnapshot
should be moved up toDatabaseClusterBaseProps
and should default totrue
forDatabaseClusterFromSnapshot
for consistency.Additional Information/Context
You can work around this temporarily by setting the value on the L1 construct, e.g.:
CDK CLI Version
2.20.0
Framework Version
No response
Node.js Version
16.14.0
OS
macOS
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: