Ресурс google_compute_firewalls
Синтаксис
Используется google_compute_firewalls, чтобы проверить ресурс Google Firewall.
Ресурс бета-версии
Этот ресурс имеет поля бета-версии. Чтобы получить доступ к этим полям, включите beta: true в конструктор ресурса.
Примеры
describe google_compute_firewalls(project: 'chef-gcp-inspec') do
its('count') { should be >= 1 }
its('firewall_names') { should include 'inspec-gcp-firewall' }
its('firewall_directions') { should include 'INGRESS' }
end
Проверка, что для проекта доступно не более указанного количества брандмауэров
describe google_compute_firewalls(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
Проверка, что ожидаемый брандмауэр доступен для проекта
describe google_compute_firewalls(project: 'chef-inspec-gcp') do
its('firewall_names') { should include "my-app-firewall-rule" }
end
Проверка, что определённое правило с указанным именем не существует
describe google_compute_firewalls(project: 'chef-inspec-gcp') do
its('firewall_names') { should_not include "default-allow-ssh" }
end
Проверка отсутствия брандмауэров для направления «INGRESS»
describe google_compute_firewalls(project: 'chef-inspec-gcp').where(firewall_direction: 'INGRESS') do
it { should_not exist }
end
Свойства
Свойства, к которым можно получить доступ из ресурса google_compute_firewalls:
Для получения дополнительной информации см. ресурс google_compute_firewall.
alloweds- массив
google_compute_firewallразрешений creation_timestamps- массив
google_compute_firewallcreation_timestamp denieds- массив
google_compute_firewallзапрещённых правил descriptions- массив
google_compute_firewalldescription destination_ranges- массив
google_compute_firewalldestination_ranges firewall_directions- массив
google_compute_firewallнаправления (direction) disableds- массив
google_compute_firewalldisabled log_configs- массив
google_compute_firewalllog_config firewall_ids- массив
google_compute_firewallid firewall_names- массив
google_compute_firewallname networks- массив
google_compute_firewallnetwork priorities- массив
google_compute_firewallpriority source_ranges- массив
google_compute_firewallsource_ranges source_service_accounts- массив
google_compute_firewallsource_service_accounts source_tags- массив
google_compute_firewallsource_tags target_service_accounts- массив
google_compute_firewalltarget_service_accounts target_tags- массив
google_compute_firewalltarget_tags
Критерии фильтрации
Этот ресурс поддерживает все вышеперечисленные свойства в качестве критериев фильтрации, которые могут быть использованы с where в виде блока или метода.
Разрешения GCP
Убедитесь, что API Compute Engine включен для текущего проекта.
© 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_compute_firewalls/