I recently read about conditions in GCP and how one can use them to add logic to a role. I would like to give a user a role to assign roles to service accounts. But if I do that, the user will also be able to invite other users to the project and that I do not want.
I experimented with things like:
gcloud projects add-iam-policy-binding <project> --member="user:useremail@gmail.com" --role="roles/accesscontextmanager.policyEditor" --condition='title="allow_admin_service_user_only",expression=resource.name.startsWith("iam.googleapis.com/projects/project/serviceAccounts")
gcloud projects add-iam-policy-binding <project> --member="user:useremail@gmail.com" --role="roles/iam.roleAdmin" --condition='title="allow_admin_service_user_only",expression=resource.name.startsWith("iam.googleapis.com/projects/project/serviceAccounts")
Tried multiple other roles as well but they all fail with the same exact error:
ERROR: (gcloud.projects.add-iam-policy-binding) User [user@gmail.com] does not have permission to access projects instance [project:setIamPolicy] (or it may not exist): Policy update access denied.
Question is: Is it possible to allow editing/adding/revoking roles only on service accounts? and if yes, how?