Open kadaan opened 4 years ago
Not sure if something is missing here. I think also the initAwsProvider(*profile, *region, *maxRetries)
has to be also specifically initialized for the region one wants to work with (https://github.com/cloudetc/awsweeper/pull/50/files#diff-c4de833e2982802ae3a842e94963b5c7R69).
We probably need to add an integration test for this too, so that we can the issue I mentioned. I can provide a test if I find time
This is simply about exposing the region specified on the cli as part of the resources, so that it can be filtered on. This allows me to write a config that I can use in different regions and will perform differently.
@jckuester This should be resurrected. The whole concept of this still works in the re-write you have done. It enables you to write a cleanup specification like:
aws_instance:
- region: NOT(us-east-1)
tags:
Name: my-server-\d+-.+
created:
before: 1h
- region: us-east-1
tags:
Name: my-server-0[^1]-.+
created:
before: 1h
@kadaan I picked the code from your branches (hope that is OK) and added some tests: https://github.com/jckuester/awsweeper/pull/137. Lets get the region filter feature merged first and the let's focus on the optimisation for discovery that you provided in a second step.
@jckuester Sounds great! I'd love to know if the perf improvements seem good to you. For me they were a really big help when trying to cleanup resources in 13+ regions.
Add support for filtering on region so that I can have one config file that can work across multiple regions.