Ресурс google_kms_crypto_key_iam_bindings
Этот ресурс устарел. Используйте ресурс google_kms_crypto_key_iam_policy вместо него
Используйте ресурс аудита InSpec google_kms_crypto_key_iam_bindings для проверки свойств всех или отфильтрованной группы связей IAM для ключей шифрования GCP KMS.
Синтаксис
Блок ресурса google_kms_crypto_key_iam_bindings собирает связи IAM ключей шифрования GCP KMS и затем проверяет эту группу.
describe google_kms_crypto_key_iam_bindings(crypto_key_url: 'projects/project/locations/europe-west2/keyRings/key-ring/cryptoKeys/key-name') do
it { should exist }
end
Используйте этот ресурс InSpec для перечисления ролей и глубокой проверки с помощью google_kms_key_ring_iam_binding.
google_kms_crypto_key_iam_bindings(crypto_key_url: 'projects/project/locations/europe-west2/keyRings/key-ring/cryptoKeys/key-name').iam_binding_roles.each do |iam_binding_role|
describe google_kms_crypto_key_iam_binding(crypto_key_url: 'projects/project/locations/europe-west2/keyRings/key-ring/cryptoKeys/key-name', role: "roles/owner") do
it { should exist }
its('members') {should include 'user:someuser@domain.com' }
end
end
Примеры
В следующих примерах показано, как использовать этот ресурс аудита InSpec.
Проверка, что доступно не более заданного числа ролей связей IAM для ключа шифрования
describe google_kms_crypto_key_iam_bindings(crypto_key_url: 'projects/project/locations/europe-west2/keyRings/key-ring/cryptoKeys/key-name') do
its('count') { should be <= 100}
end
Проверка, что ожидаемая связь IAM доступна для ключа шифрования
describe google_kms_crypto_key_iam_bindings(crypto_key_url: 'projects/project/locations/europe-west2/keyRings/key-ring/cryptoKeys/key-name') do
its('iam_binding_roles') { should include "roles/storage.admin" }
end
Проверка отсутствия определенной роли с помощью фильтрации множественного ресурса
describe google_kms_crypto_key_iam_bindings(crypto_key_url: 'projects/project/locations/europe-west2/keyRings/key-ring/cryptoKeys/key-name').where(iam_binding_role: "roles/iam.securityReviewer") do
it { should_not exist }
end
Критерии фильтрации
Этот ресурс поддерживает следующие критерии фильтрации: iam_binding_role. Это может использоваться с where, как в блоке, так и как метод.
Свойства
-
iam_binding_roles- массив строк роли google_kms_crypto_key_iam_binding, например["roles/compute.admin", "roles/owner"]
Разрешения GCP
Убедитесь, что API Cloud Key Management Service (KMS) включен для проекта, где расположен ресурс.
© 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_kms_crypto_key_iam_bindings/