A google_service_accounts is used to test a Google ServiceAccount resource
describe google_service_accounts(project: 'chef-gcp-inspec', name: "[email protected]") do
its('service_account_emails') { should include "[email protected]" }
its('count') { should be <= 1000 }
end
describe google_service_accounts(project: 'chef-inspec-gcp') do
its('count') { should be <= 1000}
end
describe google_service_accounts(project: 'chef-inspec-gcp') do
its('service_account_display_names'){ should include "gcp_sa_name" }
end
describe google_service_accounts(project: 'chef-inspec-gcp') do
its('service_account_ids'){ should include 12345678 }
end
describe google_service_accounts(project: 'dummy-project') do
its('service_account_names'){ should include "projects/dummy-project/serviceAccounts/[email protected]" }
end
google_service_accounts(project: 'chef-inspec-gcp').where(service_account_display_names: /^dummyaccount/).service_account_names.each do |sa_name|
describe google_service_account(name: sa_name) do
it { should exist }
end
end
Properties that can be accessed from the google_service_accounts resource:
See the google_service_account resource for more information.
service_account_namesgoogle_service_account nameproject_idsgoogle_service_account project_idservice_account_idsgoogle_service_account unique_idservice_account_emailsgoogle_service_account emailservice_account_display_namesgoogle_service_account display_nameoauth2_client_idsgoogle_service_account oauth2_client_idThis resource supports all of the above properties as filter criteria, which can be used with where as a block or a method.
Ensure the Identity and Access Management (IAM) API is enabled for the current project.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_service_accounts/