A google_compute_region is used to test a Google Region resource
This resource has beta fields available. To retrieve these fields, include beta: true in the constructor for the resource
describe google_compute_region(project: 'chef-gcp-inspec', name: 'europe-west2') do
it { should exist }
it { should be_up }
its('zone_names') { should include "#{gcp_location}-a" }
end
describe google_compute_region(project: 'chef-gcp-inspec', name: 'notthere') do
it { should_not exist }
end
describe google_compute_region(project: 'chef-inspec-gcp', region: 'europe-west2') do
it { should exist }
end
describe google_compute_region(project: 'chef-inspec-gcp', region: 'europe-west2') do
its('status') { should eq 'UP' }
# or equivalently
it { should be_up }
end
describe google_compute_region(project: 'chef-inspec-gcp', region: "asia-east1") do
its('id') { should eq "1220" }
end
describe google_compute_region(project: 'chef-inspec-gcp', region: "asia-east1") do
its('zones') { should include "https://www.googleapis.com/compute/v1/projects/spaterson-project/zones/asia-east1-a" }
end
describe google_compute_region(project: 'chef-inspec-gcp', region: "asia-east1") do
its('zone_names') { should include "asia-east1-a" }
end
The zone_names property is also useful for subsequently looping over associated google_compute_zone resources. For example:
google_compute_region(project: 'chef-inspec-gcp', region: "asia-east1").zone_names.each do |zone_name|
describe google_compute_zone(project: 'chef-inspec-gcp', name: zone_name) do
it { should be_up }
end
end
Properties that can be accessed from the google_compute_region resource:
creation_timestampdeprecateddeleteddeprecatedobsoletereplacementstatePossible values:
descriptionidnamequotasmetriclimitusageownerstatuszonesEnsure the Compute Engine API is enabled for the current project.
© 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_region/