Project: Chef InSpec (Provisioning / Security & Compliance)
File: google_compute_region.md

+++ title = "googlecomputeregion resource" draft = false gh_repo = "inspec" platform = "gcp" [menu] [menu.inspec] title = "googlecomputeregion" identifier = "inspec/resources/gcp/googlecomputeregion.md googlecomputeregion resource" parent = "inspec/resources/gcp" +++ A `googlecomputeregion` 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 ```ruby describe googlecomputeregion(project: 'chef-gcp-inspec', name: 'europe-west2') do it { should exist } it { should be_up } its('zonenames') { should include "#{gcplocation}-a" } end describe googlecomputeregion(project: 'chef-gcp-inspec', name: 'notthere') do it { should_not exist } end ``` ```ruby describe googlecomputeregion(project: 'chef-inspec-gcp', region: 'europe-west2') do it { should exist } end ``` ```ruby describe googlecomputeregion(project: 'chef-inspec-gcp', region: 'europe-west2') do its('status') { should eq 'UP' } it { should be_up } end ``` ```ruby describe googlecomputeregion(project: 'chef-inspec-gcp', region: "asia-east1") do its('id') { should eq "1220" } end ``` ```ruby describe googlecomputeregion(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 ``` ```ruby describe googlecomputeregion(project: 'chef-inspec-gcp', region: "asia-east1") do its('zone_names') { should include "asia-east1-a" } end ``` The `zonenames` property is also useful for subsequently looping over associated `googlecompute_zone` resources. For example: ```ruby googlecomputeregion(project: 'chef-inspec-gcp', region: "asia-east1").zonenames.each do |zonename| describe googlecomputezone(project: 'chef-inspec-gcp', name: zone_name) do it { should be_up } end end ``` Properties that can be accessed from the `googlecomputeregion` resource: `creation_timestamp` : Creation timestamp in RFC3339 text format. `deprecated` : The deprecation state of this resource. `deleted` : An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DELETED. `deprecated` : An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to DEPRECATED. `obsolete` : An optional RFC3339 timestamp on or after which the deprecation state of this resource will be changed to OBSOLETE. `replacement` : The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. `state` : The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, or DELETED. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. Possible values: DEPRECATED OBSOLETE DELETED `description` : An optional description of this resource. `id` : The unique identifier for the resource. `name` : Name of the resource. `quotas` : Quotas assigned to this region. `metric` : Name of the quota metric. `limit` : Quota limit for this metric. `usage` : Current usage of this metric. `owner` : Owning resource. This is the resource on which this quota is applied. `status` : Status of the region, either UP or DOWN. Possible values: UP DOWN `zones` : List of zones within the region Ensure the is enabled for the current project.