Skip to main content

azure_redis_cache Resource

Use the azure_redis_cache InSpec audit resource to test the properties related to an Azure Redis cache.

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

resource_group and name are required parameters.

describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  it                                      { should exist }
  its('name')                             { should cmp 'REDIS_CACHE_NAME' }
  its('type')                             { should cmp 'Microsoft.Cache/Redis' }
  its('sku.name')                         { should cmp 'Standard' }
  its('sku.family')                       { should cmp 'C' }
  its('location')                         { should cmp 'southcentralus' }
end
describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  it  { should exist }
end

Parameters

resource_group
Azure resource group where the targeted resource resides.
name
Name of the Azure Redis cache to test.

The parameter set should be provided for a valid query are resource_group and name.

Properties

id
Resource ID.
name
Redis cache name.
location
Redis cache location.
type
Resource type.
tags
Resource tags.
properties.sku.name
The type of Redis cache to deploy. Valid values are Basic, Standard, and Premium.
properties.sku.family
The SKU family to use. Valid values are C and P (C = Basic/Standard, P = Premium).
properties.sku.capacity
The size of the Redis cache to deploy. Valid values are C (Basic/Standard; family: 0, 1, 2, 3, 4, 5, 6) and P (Premium, family: 1, 2, 3, 4).
properties.provisioningState
The resource’s provisioning state.
properties.redisVersion
Redis version.
properties.enableNonSslPort
Specifies whether the non-SSL Redis server port (6379) is enabled.

For properties applicable to all resources, such as type, name, id, and properties, refer to azure_generic_resource.

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

Examples

Test that the Redis instance’s provisioning status equals ‘Succeeded’

describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  its('properties.provisioningState') { should eq 'Succeeded' }
end

Test that the Redis instance Skuname equals ‘Standard’

Skuname is the Redis cache to deploy. Valid values are Basic, Standard, and Premium.

describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  its('properties.sku.name') { should eq 'Standard' }
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 Redis cache is found, it will exist.

describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  it { should exist }
end

not_exists


# Redis Caches that aren't found, will not exist.
describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  it { should_not exist }
end

be_enabled_non_ssl_port

Ensure that the Redis cache supports non-SSL ports.

describe azure_redis_cache(resource_group: 'RESOURCE_GROUP', name: 'REDIS_CACHE_NAME') do
  it { should be_enabled_non_ssl_port }
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