Skip to main content

azure_dns_zones_resource Resource

Use the azure_dns_zones_resource InSpec audit resource to test the properties of an Azure DNS zone.

Azure REST API Version, Endpoint, and HTTP Client Parameters

This resource interacts with API versions supported by the resource provider. The api_version can be defined as a resource parameter. If not provided, this resource uses the latest version. For more information, refer to the azure_generic_resource document.

Unless defined, this resource uses the azure_cloud global endpoint and default values for the HTTP client. For more information, refer to the resource pack README.

Install

This resource is available in the Chef InSpec Azure resource pack.

For information on configuring your Azure environment for Chef InSpec and creating an InSpec profile that uses the InSpec Azure resource pack, see the Chef InSpec documentation for the Azure cloud platform.

Syntax

This resource requires either the resource_group, and DNS zone resource name or the resource_id.

describe azure_dns_zones_resource(resource_group: 'RESOURCE_GROUP_NAME', name: 'DNS_ZONE_NAME') do
  it { should exist }
end

Or

describe azure_dns_zones_resource(resource_id: 'DNS_ZONE_RESOURCE_ID') do
  it { should exist }
end

Parameters

resource_group
Azure resource group where the targeted resource resides.
name
Name of the DNS zone to test.
resource_id
The resource ID of the DNS zone to test.

The resource_group and name, or the resource_id are required parameters.

Properties

name
Name of the Azure resource to test.
type
The type of DNS zone.
max_number_of_recordsets
The maximum number of record sets that can be created in this DNS zone.
number_of_record_sets
The current number of record sets in this DNS zone.
name_servers
The name servers for this DNS zone.
properties
The properties of the Azure DNS zone resource.
location
The DNS zone resource location.

Also, refer to the Azure documentation for other available properties. Any attribute in the response may be accessed with the key names separated by dots (.).

Examples

Test that the Azure DNS zone resource has the correct resource type

describe azure_dns_zones_resource(resource_group: 'RESOURCE_GROUP_NAME', name: 'DNS_ZONE_NAME') do
  its('type') { should eq 'Microsoft.Network/dnszones' }
end

Test that the location of the Azure DNS zone resource is ‘global’

describe azure_dns_zones_resource(resource_group: 'RESOURCE_GROUP_NAME', name: 'DNS_ZONE_NAME') do
  its('location') { should eq 'global' }
end

Matchers

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

exists

# If a DNS Zone resource is found, it will exist.

describe azure_dns_zones_resource(resource_group: 'RESOURCE_GROUP_NAME', name: 'DNS_ZONE_NAME') do
  it { should exist }
end

# DNS Zone resources that aren't found, will not exist.

describe azure_dns_zones_resource(resource_group: 'RESOURCE_GROUP_NAME', name: 'DNS_ZONE_NAME') do
  it { should_not exist }
end

Azure Permissions

Your Service Principal must be set up with at least a contributor role on the subscription you wish to test.

Edit this page on GitHub

Thank you for your feedback!

×










Search Results