fix(gce-cleanup): add security-groups cleanup in the cleanup script #238
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 python script to cleanup security groups.
Before there was a TODO intending that since we don't store files between runs we can't compute the diff between old and new.
Now: I've used the same approach as the aws cleanup, where we get all security group with a prefix and we try to delete everything.
QA
gcloud compute firewall-rules create rule-to-test-delete --allow=tcp:9999 --source-ranges="192.168.1.0/24" --description="test firewall rule to delete"python3 jobs/z-jobs/scripts/gce.py --sa-email <redacted> --project-id <redacted> --pem-path <redacted> --dry-run delete-security-groups 'rule'-> and you should see the rule in stdout
python3 jobs/z-jobs/scripts/gce.py --sa-email <redacted> --project-id <redacted> --pem-path <redacted> delete-security-groups 'rule'-> and now the rule is gone.