leftovers icon indicating copy to clipboard operation
leftovers copied to clipboard

Feature/regex matching

Open notrepo05 opened this issue 3 years ago • 5 comments

We would like to be able to match using regex. I'm opening this as a draft since we plan to continue working / redesigning before trying to get our changes merged in :).

Example use case:

nrohn-a01 nr $ BBL_IAAS=aws ./leftovers -f "pull-1408.*security" --aws-secret-access-key=*** --aws-access-key-id=***  --aws-region=*** --dry-run --filter-as-regex
[EC2 Security Group: nat_security_group (Name:pull-1408-nat-security-group, Environment:pull-1408, Application:Cloud Foundry)]
[EC2 Security Group: ops_manager_security_group (Environment:pull-1408, Application:Cloud Foundry, Name:pull-1408-ops-manager-security-group)]
[EC2 Security Group: web_lb_security_group (Name:pull-1408-lb-security-group, Environment:pull-1408, Application:Cloud Foundry)]
[EC2 Security Group: rds_security_group (Application:Cloud Foundry, Name:pull-1408-rds-security-group, Environment:pull-1408)]
[EC2 Security Group: tcp_lb_security_group (Environment:pull-1408, Application:Cloud Foundry, Name:pull-1408-tcp-lb-security-group)]
[EC2 Security Group: ssh_lb_security_group (Name:pull-1408-ssh-lb-security-group, Environment:pull-1408, Application:Cloud Foundry)]
...

This PR also reorders some AWS resource deletion by their type, and adds waits to a couple resources so we don't fail improperly (especially important for RDS, which takes ~10 minutes to delete)

Thanks!

cc @ciriarte

notrepo05 avatar Jun 15 '21 02:06 notrepo05

TODOs

  • Remove debugging lines
  • Add test coverage for AWS reordering and waits

notrepo05 avatar Jun 15 '21 02:06 notrepo05

Hi @genevieve, if we wanted to get this merged upstream I assume we'll need to reintroduce vendoring and add more test coverage? Would you also want us to refactor the regex filter flag? We can also maintain our own fork if that's preferable. Thank you!!

notrepo05 avatar Jun 22 '21 16:06 notrepo05

Hey Nick! Yes, if you wouldnt mind reintroducing vendoring and adding more test coverage, we can merge these changes!

genevieve avatar Jun 22 '21 16:06 genevieve

Thanks! I'll try to get it ready to be merged in a couple weeks.

notrepo05 avatar Jun 23 '21 20:06 notrepo05

Thank you for the review @rowanjacobs. I still need to get around to getting this ready for merge. I'm trying to find time

notrepo05 avatar Jul 08 '21 23:07 notrepo05