Skip to content
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

Merged
merged 6 commits into from
Dec 6, 2021
Merged

feat(core): add applyRemovalPolicy to IResource #17746

merged 6 commits into from
Dec 6, 2021

Conversation

mskrip
Copy link
Contributor

@mskrip mskrip commented Nov 29, 2021

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

@gitpod-io
Copy link

gitpod-io bot commented Nov 29, 2021

@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Nov 29, 2021
@mskrip mskrip marked this pull request as draft November 29, 2021 13:06

Verified

This commit was signed with the committer’s verified signature.
yyx990803 Evan You
Close #17728
@mskrip mskrip marked this pull request as ready for review November 29, 2021 15:40
Copy link
Contributor

@skinny85 skinny85 left a 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);
Copy link
Contributor

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);?

Copy link
Contributor Author

@mskrip mskrip Nov 29, 2021

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.

Copy link
Contributor

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(...? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That works 🙂 Updated

@skinny85 skinny85 changed the title feat(core): add applyRemovalPolicy for IResource feat(core): add applyRemovalPolicy in IResource Nov 29, 2021
@skinny85 skinny85 changed the title feat(core): add applyRemovalPolicy in IResource feat(core): add applyRemovalPolicy to IResource Nov 29, 2021
Co-authored-by: Adam Ruka <adamruka85@gmail.com>
@mergify mergify bot dismissed skinny85’s stale review November 29, 2021 16:13

Pull request has been modified.

@mskrip mskrip requested a review from skinny85 November 29, 2021 16:13
@skinny85 skinny85 added the pr-linter/exempt-readme The PR linter will not require README changes label Nov 29, 2021
@mskrip
Copy link
Contributor Author

mskrip commented Dec 6, 2021

Hey @skinny85, is there something I can do for this PR? Or is this just waiting on some spare time? 🙂

@skinny85
Copy link
Contributor

skinny85 commented Dec 6, 2021

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!

@mergify
Copy link
Contributor

mergify bot commented Dec 6, 2021

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: e32fea8
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit d64057f into aws:master Dec 6, 2021
@mergify
Copy link
Contributor

mergify bot commented Dec 6, 2021

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).

@mskrip mskrip deleted the iresource-apply-removal-policy branch December 7, 2021 08:34
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-rds): Cannot change removal policy of DatabaseInstance's admin secret
4 participants