mpostument / awstaghelper

AWS bulk tagging tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request : Support for renaming and deleting Tags from resources

rams3sh opened this issue · comments

commented

Currently based on my experimentation , I could understand that modifying an existing value of a tag key and adding a new tag is possible.

However, deletion and renaming of tags cannot be done. It would be great to have such a support.

I have proposed a possible solution below:-

The column Names can be suffixed with a keyword like (:DELETE) or (:RENAME). Check the example below

Example :-

Before :-

Id Name Environment
i-123 Staging
i-345 IAmNames Prod

After :-

Id Name(: RENAME : "Names" : [ ALL_WITH_TAG, "CHAR:*" ] ) Environment(: DELETE : ["CHAR:$"] ) (: MARKER )
i-123 Staging $,*
i-345 IAmNames Prod *

In the above column , it follows the following fashion

i) For RENAME:

<Key>(:RENAME:"\<NewKey\>":[ALL_WITH_TAG, "CHAR:*" ]) - means rename existing key <Key> to <NewKey> for all resource listed below where the key exists and holds values and also the ones marked with * in the :MARKER column.

ii) For DELETE :
(:DELETE:<marker_value>) - means delete the tag Environment for all resources where the new (:MARKER) column is marked with <marker_value> , in above case $. Notice the difference in table in both cases.

So generically , it can be of following nature. Any new action on a key can be suffixed with a bracket (which would mostly not be used in tag keys in normal situation) followed by an action (like RENAME, DELETE). Followed by it's arguments and at last the markers.

RENAME needs an argument of new Key whereas DELETE does not.

Every ACTION requires a marker which tells it to which resource it applies to. Markers can be the last argument to all actions. All in between actions can be other arguments.

Markers could be array [] , where multiple marking criteria can be defined, like the one used for RENAME above.

Possible markers can be:-

i. ALL - Applies to all even if the resource does not have that tag present. In case of RENAME for value , a dummy value (such as an empty string) can be added. 
ii. ALL_WITH_TAG - Applies to all resources with that particular tag present
iii. "CHAR:<any_char_marker>" - Applies to all resource where that field has been marked by char marker in (:MARKER) column. This would require a separate (:MARKER) column. Having an option to give any char is necessary. If delete also needs to be done at the same time. So two different char markers for each can be plotted in (:MARKER) column.
iv. "REGEX:"<csv_column>":<any_valid_regex_marker>" - Apples to all resource whose concerned column's value matches the provided regex marker. Having column here helps to have it as a condition to match against any attribute of the resource in csv. 

The above solution is just an idea that I thought, which could be one of the ways to implement this through csv. Thought of putting it here in case it helps. Feel free to ignore if you don't see much value.

However, if this feature is implemented, it will be really helpful if used along with #15 to remediate compliance and other issues in one's account and understand one's tag structure across.

I haven't think about deletion/renaming. But it a good idea. Added this to my roadmap