99designs / iamy

A cli tool for importing and exporting AWS IAM configuration to YAML files
MIT License
238 stars 24 forks source link

Remove excess policy versions to avoid service limits #29

Closed andrewjhumphrey closed 7 years ago

andrewjhumphrey commented 7 years ago

AWS has a default limit of 5 policy versions, it can perhaps be bumped but it's not listed in their support requests.

So this attempts to delete the oldest policy version when we hit the limit of 5, it doesn't try and be clever and detect the error, it's just hard coded for now.

It does this by decorating the Policy struct with a couple of attributes and maintains them when iterating over the lists of policy versions.

When emitting the diff it add a policy-version-delete command if it's required.

Attempts to address: https://github.com/99designs/iamy/issues/21

mtibben commented 7 years ago

Rebased in #32. Thanks for the fix @andrewjhumphrey, much appreciated!