feat(gcp): add Cloud Run service and job resources#1067
Open
Amit2465 wants to merge 2 commits intogruntwork-io:masterfrom
Open
feat(gcp): add Cloud Run service and job resources#1067Amit2465 wants to merge 2 commits intogruntwork-io:masterfrom
Amit2465 wants to merge 2 commits intogruntwork-io:masterfrom
Conversation
Add support for nuking GCP Cloud Run services using the generic resource pattern. Services are discovered per region and deleted sequentially with long-running operation polling. Safety: - Skip services in locations where Cloud Run is not enabled - Already-deleted services (404) are handled gracefully - Delete failures do not affect other services (SequentialDeleter)
Add support for nuking GCP Cloud Run jobs using the generic resource pattern. Jobs are discovered per region and deleted sequentially with long-running operation polling. Safety: - Skip jobs in locations where Cloud Run is not enabled - Already-deleted jobs (404) are handled gracefully - Delete failures do not affect other jobs (SequentialDeleter)
Contributor
|
Good structure — clean split between shared location enumeration (v1) and resource-specific list/delete (v2 gRPC). A few items:
|
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 Run service (
cloud-run-service) and Cloud Run job (cloud-run-job) as new supported cloud-nuke resources.How it works
List: Enumerates all available Cloud Run locations for the project using the Cloud Run Admin API v1 REST client, then queries each location individually using the v2 gRPC client. The v2 API does not support the
locations/-wildcard forListServicesorListJobs, so explicit location enumeration is required. Both resources share a commonlistCloudRunLocationshelper. If listing fails for a given location, that location is skipped without aborting the remaining locations.Delete: Sends a delete request for each resource using the v2 gRPC client and waits for the returned long-running operation to complete. Already-deleted resources (404) are handled gracefully. For jobs, any active executions are automatically cancelled by the API before deletion.
Identifier format: Full resource name —
projects/{project}/locations/{location}/services/{name}andprojects/{project}/locations/{location}/jobs/{name}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 both Cloud Run services and jobsTODOs
Read the Gruntwork contribution guidelines.
nuke_sandboxandnuke_phxdevopsjobs in.circleci/config.ymlhave been updated with appropriate exclusions. (Note:nuke_sandboxandnuke_phxdevopsonly runaws, so no exclusions are needed for these new GCP resources.)Release Notes (draft)
Added GCP Cloud Run service (
cloud-run-service) and Cloud Run job (cloud-run-job) as new supported resource types.Migration Guide
This PR introduces
cloud-run-serviceandcloud-run-jobas new GCP resource types. Sincecloud-nukeautomatically includes all registered resource types, Cloud Run services and jobs will be nuked by default if no config file is provided.To opt out, add the following to your
cloud-nuke.ymlconfig file: