title | platform |
---|---|
About the google_users Resource |
gcp |
Use the google_users
InSpec audit resource to test properties of all, or a filtered group of, GCP users.
A google_users
resource block collects GCP users for the specified customer. As documented here, this defaults to the my_customer
alias to represent your account's customerId
.
describe google_users(customer: 'my_customer') do
it { should exist }
end
The domain
argument can optionally be provided to get fields from only one domain. Either the customer or the domain parameter must be provided.
describe google_users(domain: 'my_domain.com') do
it { should exist }
end
Use this InSpec resource to enumerate IDs then test in-depth using google_user
.
google_users(customer: 'my_customer').user_ids.each do |user_id|
describe google_user(user_key: user_id) do
it { should exist }
it { should_not be_suspended }
end
end
The following examples show how to use this InSpec audit resource.
describe google_users(customer: 'my_customer') do
its('count') { should be <= 100}
end
describe google_users(customer: 'my_customer') do
its('user_names') { should include "Monsieur Happy" }
end
google_users(customer: 'my_customer').where(user_full_name: /Batman/).user_ids.each do |user_id|
describe google_user(user_key: user_id) do
it { should exist }
end
end
This resource supports the following filter criteria: user_id
; user_full_name
and user_email
. Any of these may be used with where
, as a block or as a method.
user_ids
- an array of google_user identifier integersuser_full_names
- an array of google_user full name stringsuser_emails
- an array of google_user primary email address strings
Ensure the G Suite Admin SDK Directory API is enabled and you have sufficient privileges to list users.