feat(gcp): add Cloud SQL instance resource#1066
Open
Amit2465 wants to merge 1 commit intogruntwork-io:masterfrom
Open
feat(gcp): add Cloud SQL instance resource#1066Amit2465 wants to merge 1 commit intogruntwork-io:masterfrom
Amit2465 wants to merge 1 commit intogruntwork-io:masterfrom
Conversation
Contributor
|
Looks good overall. A few items:
|
Add support for nuking GCP Cloud SQL instances using the generic resource pattern. Instances are discovered via paginated list and deleted sequentially with long-running operation polling. Safety: - Skip instances in transient states (PENDING_CREATE, PENDING_DELETE, MAINTENANCE, ONLINE_MAINTENANCE, REPAIRING) - Skip deletion-protected instances with a warning - Skip externally managed instances (EXTERNAL backend / ON_PREMISES_INSTANCE type) - Delete read replicas and read pool nodes before primary instances to satisfy API ordering constraints
b0132b3 to
2525a63
Compare
Contributor
Author
|
Thanks for the review, all fixed.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add GCP Cloud SQL instance (
cloud-sql-instance) as a new supported cloud-nuke resource.How it works
List: Paginates through all Cloud SQL instances in the project. Instances in transient states (
PENDING_CREATE,PENDING_DELETE,MAINTENANCE,ONLINE_MAINTENANCE,REPAIRING), instances with deletion protection enabled, and externally managed instances (EXTERNALbackend /ON_PREMISES_INSTANCEtype) are skipped. Read replicas and read pool nodes are returned before primary instances to ensure correct deletion order, the Cloud SQL API rejects deletion of a primary that still has active replicas.Delete: Sends a delete request for each instance and polls the returned long-running operation until it reaches
DONE. Already-deleted instances (404) are handled gracefully.Identifier format: Composite —
{project}/{instance}Test output
Pre-commit checks:
gofmt— no issuesgolangci-lint run ./...— 0 issuesgo build ./...— cleango vet ./...— cleanManually verified against a real GCP project:
inspect-gcpcorrectly lists Cloud SQL instancesTODOs
Read the Gruntwork contribution guidelines.
nuke_sandboxandnuke_phxdevopsjobs in.circleci/config.ymlhave been updated with appropriate exclusions (either directly in the job or via the.circleci/nuke_config.ymlfile) to prevent nuking IAM roles, groups, resources, etc that are important for the test accounts. (Note:nuke_sandboxandnuke_phxdevopsonly runaws, so no exclusions are needed for this new GCP resource.)Release Notes (draft)
Added GCP Cloud SQL instance (
cloud-sql-instance) as a new supported resource type.Migration Guide
This PR introduces
cloud-sql-instanceas a new GCP resource type. Sincecloud-nukeautomatically includes all registered resource types, Cloud SQL instances will be nuked by default if no config file is provided.To opt out, add the following to your
cloud-nuke.ymlconfig file: