title | platform |
---|---|
About the google_dns_managed_zones Resource |
gcp |
Use the google_dns_managed_zones
InSpec audit resource to test properties of all, or a filtered group of, GCP DNS managed zones for a project.
A google_dns_managed_zones
resource block collects GCP zones by project then tests that group.
describe google_dns_managed_zones(project: 'chef-inspec-gcp') do
it { should exist }
end
Use this InSpec resource to enumerate IDs then test in-depth using google_dns_managed_zone
.
google_dns_managed_zones(project: 'chef-inspec-gcp').zone_names.each do |zone_name|
describe google_dns_managed_zone(project: 'chef-inspec-gcp', zone: zone_name) do
it { should exist }
end
end
The following examples show how to use this InSpec audit resource.
describe google_dns_managed_zones(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
describe google_dns_managed_zones(project: 'chef-inspec-gcp') do
its('zone_names') { should include "zone-name" }
end
google_dns_managed_zones(project: 'chef-inspec-gcp').where(zone_name: /^myzone/).zone_names.each do |zone_name|
describe google_dns_managed_zone(project: 'chef-inspec-gcp', zone: zone_name) do
it { should exist }
end
end
This resource supports the following filter criteria: zone_id
; zone_name
; zone_dns_name
and dnssec_enabled
. Any of these may be used with where
, as a block or as a method.
zone_ids
- an array of google_dns_managed_zone identifier integerszone_names
- an array of google_dns_managed_zone name stringszone_dns_names
- an array of google_dns_managed_zone dns name stringsdnssec_config_state
- an array of google_dns_managed_zone dnssec_config boolean values
Ensure the Cloud DNS API is enabled for the project.