1

When listing projects, we can filter on name using: gcloud projects list --filter='name:xxxx*'

How to store this filter in gcloud configuration so everytime we run gcloud projects list we get filtered projects ?

Note: I don't want a command alias, I need a "per gcloud configuration" filter.

Thanks

r2d2leboss
  • 11
  • 1
  • 1
    AFAIK, you can't! – guillaume blaquiere Jul 12 '21 at 14:39
  • 1
    @guillaume-blaquiere is correct, you cannot. However, users only list projects to which they have access. So, if you're trying to limit the list of projects that your users(' credentials) can `list`, it may be that you should consider limiting the projects to which the users(' credentials) have access. – DazWilkin Jul 12 '21 at 15:26
  • @DazWilkin Would you like to post it as an answer for better visibility? – Farid Shumbar Jul 13 '21 at 12:46

1 Answers1

3

@guillaume-blaquiere is correct, you cannot.

However, users are only able to list projects to which they have access.

So, if you're trying to limit the list of projects that your users(' credentials) can list, a more robust solution would be to consider limiting the projects to which the users(' credentials) have access.

Depending on whether you're using a organization you can do this either at the organization/folder(s) level or at the project-level directly.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88