Answers4AWS / graffiti-monkey

Goes around tagging things
Apache License 2.0
255 stars 88 forks source link

Support for adding new tags to instances based on existing ones #51

Open m0un10 opened 4 years ago

m0un10 commented 4 years ago

This PR adds functionality to graffiti monkey to allow for new tags to be added to instances based on existing ones. For example, if our instances were named dev-01 and dev-02, we could add a rule to add an owner=devmgr@mycompany.com and team=dev tag for any name starting with dev. This is achieved by regular expression rules. For example:

_instance_tags_to_add:
 - key: Name
   matches:
     - match: ^dev.*
       description: Development
       tags_to_set_if_match:
         owner: devmgr@mycompany.com
         team: dev

EXOK-QqVAAADwRh

Existing functionality is not impacted by this addition. The instance tagging is not triggered unless _instance_tags_to_add: is included in the configuration. This tagging can be disabled with --noinstances (as per the same convention used for volumes and snapshots) and it supports dry run with --dryrun