jckuester / awsweeper

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

Multi filter option #107

Closed opsrom closed 4 years ago

opsrom commented 4 years ago

Hi, Using awsls I can retreive some IAM Roles, for example :

My goal, delete all IAM Roles except :

So awsweeper should delete :

I try to build a filter.yml file to do this... but without success. How can I build a multi filtering on one attribute like "id" here. Any help please ?

Thanks.

jckuester commented 4 years ago

Hi @opsrom :wave:

yes, you can do that. The following filter should work for you:

aws_iam_role:
  - id: NOT(^AWSReserved|^AWSServiceRole|^MyCustomAccountAccessRole$)
opsrom commented 4 years ago

Hi @jckuester

It's the only syntax that I hadn't tried :) Thank you very much, it works perfectly !