Ресурс google_compute_instance_groups
Синтаксис
Для проверки ресурса Google InstanceGroup используется google_compute_instance_groups
Ресурс Beta
У данного ресурса доступны поля beta. Для получения этих полей, включите beta: true в конструктор ресурса
Примеры
describe google_compute_instance_groups(project: 'chef-gcp-inspec', zone: 'zone') do
its('instance_group_names') { should include 'inspec-instance-group' }
end
Проверка, что для проекта доступно не более заданного числа групп виртуальных машин
describe google_compute_instance_groups(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
Проверка, что ожидаемая группа виртуальных машин доступна для проекта
describe google_compute_instance_groups(project: 'chef-inspec-gcp', zone: 'europe-west2-a') do
its('instance_group_names') { should include "my-instance-group-name" }
end
Проверка, что подмножество всех групп виртуальных машин, соответствующих шаблону "mig*", имеет размер больше нуля
google_compute_instance_groups(project: 'chef-inspec-gcp', zone: 'europe-west2-a').where(instance_group_name: /^mig/).instance_group_names.each do |instance_group_name|
describe google_compute_instance_group(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: instance_group_name) do
it { should exist }
its('size') { should be > 0 }
end
end
Свойства
Свойства, которые можно получить из ресурса google_compute_instance_groups:
Для получения дополнительной информации см. ресурс google_compute_instance_group.
creation_timestamps- массив
google_compute_instance_groupcreation_timestamp descriptions- массив
google_compute_instance_groupdescription instance_group_ids- массив
google_compute_instance_groupid instance_group_names- массив
google_compute_instance_groupname named_ports- массив
google_compute_instance_groupnamed_ports networks- массив
google_compute_instance_groupnetwork regions- массив
google_compute_instance_groupregion subnetworks- массив
google_compute_instance_groupsubnetwork zones- массив
google_compute_instance_groupzone
Критерии фильтрации
Этот ресурс поддерживает все вышеперечисленные свойства в качестве критериев фильтрации, которые могут быть использованы с where в качестве блока или метода.
Разрешения GCP
Убедитесь, что для текущего проекта включен API Compute Engine: Compute Engine 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_compute_instance_groups/