Spec-Zone.ru › Chef 16

Ресурс google_organization_policy

[править на GitHub]

Используйте ресурс проверки InSpec для аудита ограничений, установленных в организации GCP.

Синтаксис

Политики организации Google могут ограничивать определённые сервисы GCP. Для получения дополнительной информации см. https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints

Блок ресурсов google_organization_policy описывает тесты для одного ограничения организации GCP, определяемого парой name организации и constraint:

describe google_organization_policy(name: 'organizations/123456', constraint: 'constraints/compute.disableGuestAttributesAccess') do
  it { should exist }
  its('boolean_policy.enforced') { should be true }
end

Примеры

Следующие примеры показывают, как использовать этот ресурс аудита InSpec.

Проверка, что в организации GCP установлено конкретное ограничение

describe google_organization_policy(name: 'organizations/123456', constraint: 'constraints/compute.disableGuestAttributesAccess') do
  it { should exist }
  its('boolean_policy.enforced') { should be true }
end

Проверка, что в организации GCP разрешены определённые значения для ограничения списка

describe google_organization_policy(name: 'organizations/123456', constraint: 'constraints/someListConstraint') do
  it { should exist }
  its('list_policy.allowed_values') { should include 'included_val' }
  its('list_policy.allowed_values') { should_not include 'excluded' }
  its('list_policy.denied_values') { should include 'denied' }
end

Свойства

update_time
Маркер времени последнего обновления этой политики.
boolean_policy
Доступно только для ограничений, которые являются булевыми политиками.
enforced
Булево значение, указывающее, принудительно ли применяется эта политика.
list_policy
Доступно для политик списка.
allowed_values
Список разрешённых значений в данном ресурсе.
denied_values
Список запрещённых значений в данном ресурсе.

Разрешения GCP

Убедитесь, что API Cloud Resource Manager включён для проекта по адресу https://console.cloud.google.com/apis/library/cloudresourcemanager.googleapis.com/.

© 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_organization_policy/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API