PokaInc / arnparse

Parse ARNs using Python
MIT License
36 stars 6 forks source link

Path-based resource pasing issues #3

Closed ebickle closed 5 years ago

ebickle commented 5 years ago

I noticed the library doesn't handle resources where there is both a "resourcetype" and path in the "resource".

For example, CloudWatch Log Groups ARNs take on the following format:

arn:aws:logs:us-east-1:123456789012:log-group:my-log-group:/aws/lamda/example

The arnparse library prioritizes / over : when parsing and causes the prefix slash of the log-group path to be stripped. You may want to consider changing the logic so that it checks the string index of a colon or forward-slash and then uses whichever is first as the delimiter.

The same is true for AWS Secrets Manager:

arn:aws:secretsmanager:region:account_id:secret:path/friendly_secret_name-uniqueness_code

spg commented 5 years ago

Hey @ebickle thanks for pointing that out! Made a fix for this here https://github.com/PokaInc/arnparse/pull/4