GCP Permission-to-Roles Utility

Rather than sorting through Google’s documentation
to find a role that contains the permission you need, simply pass the permission as an argument to get the list of roles that contain that permission

gptr <some.google.iam-permission>


╰─ gptr storage.hmacKeys.list
Owner (roles/owner)
Editor (roles/editor)
Viewer (roles/viewer)
Security Admin (roles/iam.securityAdmin)
Security Reviewer (roles/iam.securityReviewer)
Storage HMAC Key Admin (roles/storage.hmacKeyAdmin)


Using the correct operating system paramters for your environment, run this command.

env GOOS=<your-os> GOARCH=<your-arch> go build -o bin/gptr-<your-os><version> cmd/gptr/main.go


The executable gptr-darwin0.0.1 in /bin is a go binary built for 64-bit mac.
If you’re using mac, rename to gptr and put on your path. Otherwise build
using the instructions above and use the resulting binary.

Future Work

  • Implement fuzzy search
  • Tab completion
  • Dynamically update map when roles update


View Github