azure_redis_caches Resource
Use the azure_redis_caches InSpec audit resource to test the properties of multiple Azure Redis caches in a resource group or an entire subscription.
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
An azure_redis_caches resource block returns all Azure Redis caches within a resource group.
describe azure_redis_caches(resource_group: 'RESOURCE_GROUP') do
#...
end
or
describe azure_redis_caches(resource_group: 'RESOURCE_GROUP') do
#...
end
Parameters
The parameter should be provided for a valid query is resource_group.
resource_group- Azure resource group where the targeted resource resides.
Properties
IDs- A list of the unique resource IDs.
Field:
idnames- A list of name for all the resource names.
Field:
nametypes- A list of types for all the resources.
Field:
typelocations- A list of locations for all the resources.
Field:
locationproperties- A list of properties for all the resources.
Field:
propertiestags- A list of resource tags.
Field:
tagssku_names- A list of the types of Redis caches to deploy.
Field:
sku_namesku_capacities- A list of the sizes of the Redis caches to deploy.
Field:
sku_capacitysku_families- A list of the SKU families to use.
Field:
sku_familyinstances_ssl_ports- A list of Redis instance SSL Ports.
Field:
instances_ssl_portsis_master_instance- A list of Redis instance
is_masterflag. Field:
is_master_instanceis_primary_instance- A list of Redis instance
is_primaryflag. Field:
is_primary_instancemax_clients- A list of max clients in Redis configuration.
Field:
max_clientsmax_memory_reserves- A list of max memory reserves in Redis configuration.
Field:
max_memory_reservedmax_fragmentation_memory_reserves- A list of max fragmentation memory reserves in Redis configuration.
Field:
max_fragmentation_memory_reservedmax_memory_deltas- A list of max memory deltas in Redis configuration.
Field:
max_memory_deltaprovisioning_states- A list of provisioning_states from the properties.
Field:
provisioning_stateredis_versions- A list of Redis versions from the properties.
Field:
redis_versionenable_non_ssl_port- A list of Redis caches where the non-SSL Redis server port (6379) is enabled.
Field:
enable_non_ssl_portpublic_network_access- A list of public network access from the properties.
Field:
public_network_accessaccess_keys- A list of access keys from the properties.
Field:
access_keyshost_names- A list of host names from the properties.
Field:
host_nameports- A list of ports from the properties.
Field:
portssl_ports- A list of SSL ports from the properties.
Field:
ssl_portlinked_servers- A list of linked servers from the Redis caches.
Field:
linked_servers
Note
Examples
Loop through Redis Caches by their names
azure_redis_caches(resource_group: 'RESOURCE_GROUP').names.each do |name|
describe azure_redis_cache(name: name) do
it { should exist }
end
end
Test that there is Redis cache with a specific string in its names using client-side filtering
describe azure_redis_caches(resource_group: 'RESOURCE_GROUP').where { name.include?('spec-client') } do
it { should exist }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.This resource has the following special matchers.
exists
# Should not exist if no Redis caches are in the resource group.
describe azure_redis_caches(resource_group: 'RESOURCE_GROUP') do
it { should_not exist }
end
not_exists
# Should exist if the filter returns at least one Redis cache.
describe azure_redis_caches(resource_group: 'RESOURCE_GROUP') do
it { should exist }
end
Azure Permissions
Your Service Principal must be set up with at least a contributor role on the subscription you wish to test.