This Terraform module creates a Redis Cache instance along with firewall rules. No logging is available from this resource.
The default configuration is an highly available cluster of 3 shards and data persistence enabled on the Premium tier.
Module version | Terraform version | AzureRM version |
---|---|---|
>= 7.x.x | 1.3.x | >= 3.0 |
>= 6.x.x | 1.x | >= 3.0 |
>= 5.x.x | 0.15.x | >= 2.0 |
>= 4.x.x | 0.13.x / 0.14.x | >= 2.0 |
>= 3.x.x | 0.12.x | >= 2.0 |
>= 2.x.x | 0.12.x | < 2.0 |
< 2.x.x | 0.11.x | < 2.0 |
If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.
More details are available in the CONTRIBUTING.md file.
This module is optimized to work with the terraform-azure-loganalytics and terraform-azure-storageaccount which create some other dependent resources in azure for eg. Storage-Account & LogAnalytics Workspace.
module "storage_account" {
source = "git::https://github.com/tothenew/terraform-azure-storageaccount.git"
account_name = "{local.name_prefix}sa"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
log_analytics_workspace_id = module.log_analytics.workspace_id
account_kind = "BlobStorage"
}
module "log_analytics" {
source = "git::https://github.com/tothenew/terraform-azure-loganalytics.git"
workspace_name = "${local.name_prefix}-log"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
tags = var.extra_tags
}
module "redis" {
source = "git::https://github.com/AnkitToTheNew/terraform-azure-cache.git"
client_name = var.client_name
environment = var.environment
location = var.location
location_short = var.location
stack = var.stack
sku_name = var.sku_name
resource_group_name = azurerm_resource_group.rg.name
allowed_cidrs = ["1.2.3.4/32", "5.6.7.8/16"]
logs_destinations_ids = [
module.storage_account.account_id,
module.log_analytics.workspace_id
]
extra_tags = var.extra_tags
}
Name | Version |
---|---|
azurecaf | ~> 1.2, >= 1.2.22 |
azurerm | ~> 3.39 |
Name | Type |
---|---|
azurerm_redis_cache.redis | resource |
azurerm_redis_firewall_rule.redis_fw_rule | resource |
azurerm_storage_account.redis_storage | resource |
azurecaf_name.data_storage | data source |
azurecaf_name.redis | data source |
azurecaf_name.redis_fw_rule | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
allow_non_ssl_connections | Activate non SSL port (6779) for Redis connection | bool |
false |
no |
allowed_cidrs | List of allowed CIDR ranges to access the Azure Redis Cache resource. | any |
[] |
no |
capacity | Redis size: (Basic/Standard: 1,2,3,4,5,6) (Premium: 1,2,3,4) https://docs.microsoft.com/fr-fr/azure/redis-cache/cache-how-to-premium-clustering | number |
2 |
no |
client_name | Name of the client | string |
n/a | yes |
cluster_shard_count | Number of cluster shards desired | number |
3 |
no |
custom_diagnostic_settings_name | Custom name of the diagnostics settings, name will be 'default' if not set. | string |
"default" |
no |
custom_name | Custom name of Redis Server | string |
"" |
no |
data_persistence_enabled | "true" to enable data persistence. | bool |
true |
no |
data_persistence_frequency_in_minutes | Data persistence snapshot frequency in minutes. | number |
60 |
no |
data_persistence_max_snapshot_count | Max number of data persistence snapshots. | number |
null |
no |
data_persistence_storage_account_replication | Replication type for the Storage Account used for data persistence. | string |
"LRS" |
no |
data_persistence_storage_account_tier | Replication type for the Storage Account used for data persistence. | string |
"Premium" |
no |
data_persistence_storage_custom_name | Custom name for the Storage Account used for Redis data persistence. | string |
"" |
no |
default_tags_enabled | Option to enable or disable default tags. | bool |
true |
no |
environment | Name of the application's environnement | string |
n/a | yes |
extra_tags | Additional tags to associate. | map(string) |
{} |
no |
location | Azure region in which instance will be hosted | string |
n/a | yes |
location_short | Azure region trigram | string |
n/a | yes |
logs_categories | Log categories to send to destinations. | list(string) |
null |
no |
logs_destinations_ids | List of destination resources IDs for logs diagnostic destination. Can be Storage Account , Log Analytics Workspace and Event Hub . No more than one of each can be set.If you want to specify an Azure EventHub to send logs and metrics to, you need to provide a formated string with both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the ` |
` character. | list(string) |
n/a |
logs_metrics_categories | Metrics categories to send to destinations. | list(string) |
null |
no |
minimum_tls_version | The minimum TLS version | string |
"1.2" |
no |
name_prefix | Optional prefix for the generated name | string |
"" |
no |
name_suffix | Optional suffix for the generated name | string |
"" |
no |
patch_schedules | A list of Patch Schedule, Azure Cache for Redis patch schedule is used to install important software updates in specified time window. | list(object({ |
[] |
no |
private_static_ip_address | The Static IP Address to assign to the Redis Cache when hosted inside the Virtual Network. Changing this forces a new resource to be created. | string |
null |
no |
public_network_access_enabled | Whether the Azure Redis Cache is available from public network. | bool |
false |
no |
redis_additional_configuration | Additional configuration for the Redis instance. Some of the keys are set automatically. See https://www.terraform.io/docs/providers/azurerm/r/redis_cache.html#redis_configuration for full reference. | object({ |
{} |
no |
redis_version | Redis version to deploy. Allowed value is only 6 for new instances since v4 deprecation. | number |
6 |
no |
resource_group_name | Name of the application ressource group, herited from infra module | string |
n/a | yes |
sku_name | Redis Cache Sku name. Can be Basic, Standard or Premium | string |
"Premium" |
no |
stack | Name of the application stack | string |
n/a | yes |
subnet_id | The ID of the Subnet within which the Redis Cache should be deployed. Changing this forces a new resource to be created. | string |
null |
no |
use_caf_naming | Use the Azure CAF naming provider to generate default resource name. custom_name override this if set. Legacy default name is used if this is set to false . |
bool |
true |
no |
zones | A list of a one or more Availability Zones, where the Redis Cache should be allocated. | list(number) |
null |
no |
Name | Description |
---|---|
redis_capacity | Redis capacity |
redis_configuration | Redis configuration |
redis_family | Redis family |
redis_hostname | Redis instance hostname |
redis_id | Redis instance id |
redis_name | Redis instance name |
redis_port | Redis instance port |
redis_primary_access_key | Redis primary access key |
redis_primary_connection_string | The primary connection string of the Redis Instance. |
redis_private_static_ip_address | Redis private static IP address |
redis_secondary_access_key | Redis secondary access key |
redis_secondary_connection_string | The secondary connection string of the Redis Instance. |
redis_sku_name | Redis SKU name |
redis_ssl_port | Redis instance SSL port |
terraform_module | Information about this Terraform module |
Module managed by TO THE NEW Pvt. Ltd.
Microsoft Azure service documentation: docs.microsoft.com/en-us/azure/azure-cache-for-redis/
Apache 2 Licensed. See LICENSE for full details.