
This module creates and manages Azure Redis Cache instances. Key features:
Basic
, Standard
, and Premium
, and their corresponding featuresPremium
SKU tier)Premium
SKU tier)Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:
shellterraform login solutions.corewide.com
Initialize mandatory providers:
Copy and paste into your Terraform configuration and insert the variables:
hclmodule "tf_azure_cache" {
source = "solutions.corewide.com/azure/tf-azure-cache/azurerm"
version = "~> 1.0.0"
# specify module inputs here or try one of the examples below
...
}
Initialize the setup:
shellterraform init
Corewide DevOps team strictly follows Semantic Versioning
Specification
to
provide our clients with products that have predictable upgrades between versions. We
recommend
pinning
patch versions of our modules using pessimistic
constraint operator (~>
) to prevent breaking changes during upgrades.
To get new features during the upgrades (without breaking compatibility), use
~> 1.0
and run
terraform init -upgrade
For the safest setup, use strict pinning with version = "1.0.0"
All notable changes to this project are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
First stable version
Minimal setup for the Basic tier, which is recommended for development/test and non-critical workloads:
hclresource "azurerm_resource_group" "foo" {
name = "foo"
location = "eastus"
}
module "redis_cache" {
source = "solutions.corewide.com/azure/tf-azure-cache/azurerm"
version = "~> 1.0"
name_suffix = "bar"
tier = "Basic"
region = azurerm_resource_group.foo.location
resource_group_name = azurerm_resource_group.foo.name
}
Setup for Premium tier with custom Redis cache size, specific firewall rules, maintenance window, subnet assignment, and backup enabled:
hclresource "azurerm_resource_group" "foo" {
name = "foo"
location = "eastus"
}
module "redis_cache" {
source = "solutions.corewide.com/azure/tf-azure-cache/azurerm"
version = "~> 1.0"
name_suffix = "bar"
region = azurerm_resource_group.foo.location
resource_group_name = azurerm_resource_group.foo.name
tier = "Premium"
shard_count = 2
subnet_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1"
allowed_ip_ranges = [
{
name = "office"
start_ip = "192.168.0.0"
end_ip = "192.168.0.255"
},
]
maintenance_window = {
day = "Sunday"
hour = 2
duration = 6
}
redis_configuration = {
backup_enabled = true
}
}
Setup for the Standard tier with custom eviction policy and VNet integration:
hclresource "azurerm_resource_group" "foo" {
name = "foo"
location = "eastus"
}
module "redis_cache" {
source = "solutions.corewide.com/azure/tf-azure-cache/azurerm"
version = "~> 1.0"
name_suffix = "bar"
region = azurerm_resource_group.foo.location
resource_group_name = azurerm_resource_group.foo.name
vnet_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1"
subnet_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1"
redis_configuration = {
maxmemory_policy = "allkeys-lru"
}
}
Variable | Description | Type | Default | Required | Sensitive |
---|---|---|---|---|---|
name_suffix |
Name suffix for the created resources | string |
yes | no | |
region |
Azure region where the Redis Cache will be created | string |
yes | no | |
resource_group_name |
Name of the resource group where Redis Cache will be created | string |
yes | no | |
allowed_ip_ranges |
List of IP ranges to allow access to Redis Cache. Each object must contain name , start_ip , and end_ip |
list(object) |
[] |
no | no |
allowed_ip_ranges[*].end_ip |
string |
yes | no | ||
allowed_ip_ranges[*].name |
string |
yes | no | ||
allowed_ip_ranges[*].start_ip |
string |
yes | no | ||
engine_version |
Redis engine version. Possible values are: 4 and 6 |
string |
6 |
no | no |
machine_size |
The size of the Redis cache to deploy. Possible values are: 0 ...6 , which matches cache names C0 ...C6 for the Basic/Standard SKU tiers, and 1 ...5 matches P1 ...P5 cache names for the Premium SKU tier, respectively |
number |
1 |
no | no |
maintenance_window |
Maintenance window configuration | object |
no | no | |
maintenance_window.day |
The day of the week the maintenance window occurs (Monday , Tuesday , Wednesday , Thursday , Friday , Saturday , Sunday ) |
string |
Sunday |
no | no |
maintenance_window.duration |
Maximum allowed duration for maintenance in hours | number |
5 |
no | no |
maintenance_window.hour |
The hour in UTC when maintenance window begins (0-23) | number |
1 |
no | no |
redis_configuration |
Redis configuration parameters | object |
{} |
no | no |
redis_configuration.authentication_enabled |
If set to false, Redis instance will be accessible without authentication | bool |
true |
no | no |
redis_configuration.backup_enabled |
Enable or disable backup of Redis Cache Database (Premium SKU only) | bool |
false |
no | no |
redis_configuration.backup_frequency |
Backup frequency in minutes. Allowed values 15 , 30 , 60 , 360 , 720 , 1440 |
number |
1440 |
no | no |
redis_configuration.backup_max_snapshot_count |
Maximum number of snapshots to keep | number |
1 |
no | no |
redis_configuration.maxfragmentationmemory_reserved |
Value in megabytes reserved to accommodate for memory fragmentation | number |
no | no | |
redis_configuration.maxmemory_delta |
The max-memory delta for this Redis instance | number |
no | no | |
redis_configuration.maxmemory_policy |
How Redis will select what to remove when maxmemory is reached | string |
no | no | |
redis_configuration.maxmemory_reserved |
Value in megabytes reserved for non-cache usage e.g. failover | number |
no | no | |
redis_configuration.non_ssl_port_enabled |
Enable the non-SSL port (6379) | bool |
false |
no | no |
redis_configuration.notify_keyspace_events |
Keyspace notifications allows clients to subscribe to Pub/Sub channels | string |
no | no | |
redis_configuration.public_network_access_enabled |
Whether public network access is allowed | bool |
false |
no | no |
redis_configuration.zones |
List of availability zones for Redis Cache location | list(string) |
[] |
no | no |
shard_count |
The number of Shards (additional nodes) to create on the Redis Cluster. Applicable only for the Premium SKU tier |
number |
0 |
no | no |
subnet_id |
The ID of the subnet which the Redis Cache will be pointed to. Direct connection is available for the Premium tier only |
string |
no | no | |
tags |
Tags to be applied to the Redis Cache resources | map(string) |
{} |
no | no |
tier |
The SKU tier of the Redis Cache. Possible values are: Basic , Standard , and Premium |
string |
Standard |
no | no |
vnet_id |
VNet ID to integrate the Redis Cache into. Required for the Basic and Standard tiers only if the subnet ID is supplied for the VNet integration |
string |
no | no |
Output | Description | Type | Sensitive |
---|---|---|---|
backup_storage_account_name |
Backup storage account name | computed |
no |
connection_parameters |
Connection parameters for Redis | map |
yes |
redis_cache |
Redis Cache attributes | resource |
yes |
Dependency | Version | Kind |
---|---|---|
terraform |
>= 1.3 |
CLI |
hashicorp/azurerm |
~> 4.6 |
provider |