jckuester / awsweeper

A tool for cleaning your AWS account
Mozilla Public License 2.0
468 stars 45 forks source link

Is --region option really working? #60

Closed asyd closed 4 years ago

asyd commented 4 years ago

Hello folks,

I just discovered awseeper and I'm wondering about the usage of --region option.

With no AWS related environment variables, I have something strange:

$ env | grep AWS
$ awsweeper --region eu-west-3 --dry-run --output yaml awsweeper.yml  | cksum
INFO[0001] This is a test run, nothing will be deleted! 
3240463751 18140
awsweeper --region eu-west-1 --dry-run --output yaml awsweeper.yml  | cksum
INFO[0001] This is a test run, nothing will be deleted! 
3240463751 18140

Both call list me the same resources, but if I set AWS_DEFAULT_REGION:

export AWS_DEFAULT_REGION=eu-west-3
awsweeper --dry-run --output yaml awsweeper.yml  | cksum          
INFO[0001] This is a test run, nothing will be deleted! 
3240463751 18140
export AWS_DEFAULT_REGION=eu-west-1
awsweeper --dry-run --output yaml awsweeper.yml  | cksum
INFO[0001] This is a test run, nothing will be deleted! 
3032715009 2173

My awsweeper.yml is just a list of resources without any filters, like:

head awsweeper.yml 
---
aws_instance:
aws_autoscaling_group:
aws_ebs_snapshot:
aws_ebs_volume:

Thanks for feedbacks!

jckuester commented 4 years ago

Hey @asyd :wave: Thanks for your feedback and sorry for the inconvenient experience.

Indeed strange. So, let me confirm: the second call with AWS_DEFAULT_REGION is the expected one? I need to look into this the next few days when I find time.

asyd commented 4 years ago

@jckuester yeah, the second call is the expected result!

jckuester commented 4 years ago

Hi @asyd. Thanks again for reporting the bug. A stupid one from my side and I had not really tested the region parameter. It's fixed and tested now in the new release https://github.com/cloudetc/awsweeper/releases/tag/v0.4.1