-
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
feat(core): add applyRemovalPolicy to IResource #17746
Conversation
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.
Thanks for the contribution @mskrip! A few tiny comments before we merge this in 🙂.
const stack = new Stack(); | ||
const parent = new Parent(stack, 'Parent'); | ||
|
||
parent.child.applyRemovalPolicy(RemovalPolicy.RETAIN); |
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.
Not sure I understand the point of having parent
here? I think we can just test const child = new Child(app, 'Child'); child.applyRemovalPolicy(RemovalPolicy.RETAIN);
?
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 parent is necessary because the point is to have applyRemovalPolicy
available on resources which are typed with IResource
. If I only instantiate the child, it's just a Resource
, therefore it always had the applyResourcePolicy
method attached.
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.
So, can we do const child: IResource = new Child(...
? 🙂
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.
Thanks! That works 🙂 Updated
Co-authored-by: Adam Ruka <adamruka85@gmail.com>
Pull request has been modified.
Hey @skinny85, is there something I can do for this PR? Or is this just waiting on some spare time? 🙂 |
Nope, just Mergify dismissed my previous approval for some reason, and I didn't notice that 🙂. Thanks again for the contribution! |
Thank you for contributing! Your pull request will be updated from master 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 master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
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*
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