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

ApiGateway: parameter for changing retention policy of CloudWatchRole and Account #26827

Closed
2 tasks
nguyen102 opened this issue Aug 21, 2023 · 5 comments · Fixed by #26836
Closed
2 tasks

ApiGateway: parameter for changing retention policy of CloudWatchRole and Account #26827

nguyen102 opened this issue Aug 21, 2023 · 5 comments · Fixed by #26836
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@nguyen102
Copy link

Describe the feature

When creating ApiGateway via RestApi, the retention policy for the CloudWatchRole and Account sub-resources is RETAIN. There is no option to set the policy to DELETE. It looks like the policy used to be DELETE based on this Issue.

I would like an option to set the retention policy of those two resources to be DELETE.

Use Case

When I'm trying to destroy my CDK stack, CloudWatchRole and Account are the only two resources I have to manually delete. I would like those resources to be deleted automatically when I destroy the CDK stack.

Proposed Solution

A parameter option that I can past into RestApi Construct to delete those two resources.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

3.315.0

Environment details (OS name and version, etc.)

MacOS

@nguyen102 nguyen102 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 21, 2023
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Aug 21, 2023
@nguyen102
Copy link
Author

Related issue: #22020

@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 21, 2023
@peterwoodworth
Copy link
Contributor

Makes sense @nguyen102,

You can currently work around this with escape hatches - Check tree.json for a visual of the construct tree if you aren't sure how to override the constructs we're creating under the hood

@nguyen102
Copy link
Author

Ah, this worked. I was able to change the retention policy of the CloudWatchRole. However, I wasn't able to change the retention policy of Account. I also wasn't able to find that resource in the console. Do you know how I can manually delete that resource after I delete my Cloudformation stack?

@peterwoodworth
Copy link
Contributor

Account resource seems to be just an IAM role based on the cloudformation documentation

rix0rrr added a commit to lpizzinidev/aws-cdk that referenced this issue Aug 23, 2023
mergify bot added a commit to lpizzinidev/aws-cdk that referenced this issue Aug 23, 2023
@mergify mergify bot closed this as completed in #26836 Aug 23, 2023
mergify bot pushed a commit that referenced this issue Aug 23, 2023
…licy (#26836)

Adds a `cloudWatchRoleRemovalPolicy` property to `RestApiBaseProps` that allows to specify a custom retention policy for CloudWatchRole and Account.
Defaults to `RemovalPolicy.RETAIN`.

Closes #26827.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants