azurerm_redis_cache

Manages a Redis Cache.

Example Usage

This example provisions a Standard Redis Cache. Other examples of the azurerm_redis_cache resource can be found in the ./examples/redis-cache directory within the GitHub Repository

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

# NOTE: the Name used for Redis needs to be globally unique
resource "azurerm_redis_cache" "example" {
  name                = "example-cache"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  capacity            = 2
  family              = "C"
  sku_name            = "Standard"
  enable_non_ssl_port = false
  minimum_tls_version = "1.2"

  redis_configuration {
  }
}

Argument Reference

The following arguments are supported:



An identity block supports the following:


A patch_schedule block supports the following:


A redis_configuration block supports the following:

Example usage:

redis_configuration {
  aof_backup_enabled              = true
  aof_storage_connection_string_0 = "DefaultEndpointsProtocol=https;BlobEndpoint=${azurerm_storage_account.nc-cruks-storage-account.primary_blob_endpoint};AccountName=${azurerm_storage_account.mystorageaccount.name};AccountKey=${azurerm_storage_account.mystorageaccount.primary_access_key}"
  aof_storage_connection_string_1 = "DefaultEndpointsProtocol=https;BlobEndpoint=${azurerm_storage_account.mystorageaccount.primary_blob_endpoint};AccountName=${azurerm_storage_account.mystorageaccount.name};AccountKey=${azurerm_storage_account.mystorageaccount.secondary_access_key}"
}
resource "azurerm_redis_cache" "example" {
  # ...
  ignore_changes = [redis_configuration[0].rdb_storage_connection_string]
}
redis_configuration {
  maxmemory_reserved = 10
  maxmemory_delta    = 2
  maxmemory_policy   = "allkeys-lru"
}

Default Redis Configuration Values

Redis Value Basic Standard Premium
enable_authentication true true true
maxmemory_reserved 2 50 200
maxfragmentationmemory_reserved 2 50 200
maxmemory_delta 2 50 200
maxmemory_policy volatile-lru volatile-lru volatile-lru

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:


A redis_configuration block exports the following:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Redis Cache's can be imported using the resource id, e.g.

terraform import azurerm_redis_cache.cache1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1