-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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-rds): Cannot change removal policy of DatabaseInstance's admin secret #17728
Comments
I believe this is because the secret is declared as an To work around this and apply the removal policy you want to the secret, you can use an escape hatch! Here's an example for TypeScript, let me know if you need one for Python. const db = new DatabaseInstance(this, 'db', {
vpc: vpc,
engine: dsb.DatabaseInstanceEngine.postgres({version: dsb.PostgresEngineVersion.VER_13_4})
});
const secret = db.node.children[2] as DatabaseSecret
secret.applyRemovalPolicy(RemovalPolicy.RETAIN) |
Hey @mskrip, thanks for opening the issue. Looks like the Thanks, |
The motivation behind this change is in both the linked issue and the added test case: change removal policy of a child resource with an interface type. Thanks @skinny85 for pointing me in the right direction. Closes #17728 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
That's a fair point @mskrip. I'm re-opening this one. I'm wondering what should be correct behavior be here? Should calling |
@skinny85 Yes, that makes sense. Maybe it would be useful if |
The motivation behind this change is in both the linked issue and the added test case: change removal policy of a child resource with an interface type. Thanks @skinny85 for pointing me in the right direction. Closes aws#17728 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
What is the problem?
It's not possible to change the default DatabaseInstance.secret removal policy. The instance of the secret does have a
apply_removal_policy
method bound to it (I can see it when printingdir(secret)
), but calling it makes no difference.Reproduction Steps
Create a
rds.DatabaseInstance
and the master secret will have a default removal policyDELETE
with no way to change it (even if changing the removal policy of the instance).What did you expect to happen?
I would expect, that calling
rds_instance.secret.apply_removal_policy
would apply the removal policy.What actually happened?
It doesn't
CDK CLI Version
1.134.0 (build dd5e12d)
Framework Version
1.134.0
Node.js Version
v16.12.0
OS
Arch Linux 5.15.4-arch1-1
Language
Python
Language Version
3.9.7
Other information
No response
The text was updated successfully, but these errors were encountered: