Ресурс google_service_account_keys
Синтаксис
Для проверки ресурса Google ServiceAccountKey используется google_service_account_keys
Примеры
describe google_service_account_keys(project: 'chef-gcp-inspec', service_account: "display-name@project-id.iam.gserviceaccount.com") do
its('count') { should be <= 1000 }
its('key_types') { should_not include 'USER_MANAGED' }
end
Проверка, что для учетной записи сервиса нет более заданного количества ключей
describe google_service_account_keys(project: 'sample-project', service_account: 'sample-account@sample-project.iam.gserviceaccount.com') do
its('count') { should be <= 1000}
end
Проверка наличия учетной записи сервиса с ожидаемым именем
describe google_service_account_keys(project: 'sample-project', service_account: 'sample-account@sample-project.iam.gserviceaccount.com') do
its('key_names'){ should include "projects/sample-project/serviceAccounts/test-sa@sample-project.iam.gserviceaccount.com/keys/c6bd986da9fac6d71178db41d1741cbe751a5080" }
end
Свойства
Свойства, к которым можно получить доступ из ресурса google_service_account_keys:
Для получения дополнительной информации см. ресурс google_service_account_key.
key_names- массив имён
google_service_account_key private_key_types- массив типов
google_service_account_keyprivate_key_type key_algorithms- массив алгоритмов
google_service_account_keykey_algorithm private_key_data- массив данных
google_service_account_keyprivate_key_data public_key_data- массив данных
google_service_account_keypublic_key_data valid_after_times- массив дат
google_service_account_keyvalid_after_time valid_before_times- массив дат
google_service_account_keyvalid_before_time key_types- массив типов
google_service_account_keykey_type service_accounts- массив
google_service_account_keyservice_account paths- массив путей
google_service_account_keypath
Критерии фильтрации
Этот ресурс поддерживает все вышеперечисленные свойства в качестве критериев фильтрации, которые могут быть использованы с where в виде блока или метода.
Разрешения GCP
Убедитесь, что для текущего проекта включен API управления правами доступа и идентификации (Identity and Access Management (IAM) API).
© 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_account_keys/