Unable to deploy module in Azure Managed Redis through terraform

AB, Anand 0 Reputation points

I am trying to deploy azure managed redis and I am trying to include RediSearch module through the terraform like below. But it is failing in the planning itself. There is no such clear documentation provided.

resource "azurerm_managed_redis" "redis" {
 name = local.redis_cache_name
 location = var.location
 resource_group_name = data.azurerm_resource_group.platform.name
 
 sku_name = "Balanced_B0"
 default_database {
 module = {
 name = 
 }
 }
 tags = local.default_tags
 
 public_network_access = "Disabled"
 
 
}
module "redis_cache_private_endpoint" {
 source = "../modules/private-endpoint"
 
 endpoint_name = "pep-${local.unit}-platform-redis-${local.loc}-${local.env}-${local.counter}"
 location = var.location
 resource_group_name = data.azurerm_resource_group.platform.name
 subnet_id = data.azurerm_subnet.private_endpoints.id
 service_connection_name = "pep-${local.unit}-platform-redis-${local.loc}-${local.env}-${local.counter}-conn"
 target_resource_id = azurerm_managed_redis.redis.id
 subresource_names = ["redisCache"]
 private_dns_zone_ids = [
 data.azurerm_private_dns_zone.redis.id,
 ]
 tags = local.default_tags
 
 depends_on = [azurerm_managed_redis.redis]
}
 
 

  1. Pilladi Padma Sai Manisha 10,190 Reputation points Microsoft External Staff Moderator

    Hi @AB, Anand
    Thanks for sharing the configuration.

    The issue is likely related to the Terraform configuration or AzureRM provider support rather than the private endpoint configuration.

    A few observations:

    1. The module definition is incomplete:
    default_database {
     module = {
     name =
     }
    }
    

    name is empty, which would cause validation to fail.

    1. Please verify whether your current azurerm provider version supports configuring Redis modules (such as RediSearch) through the azurerm_managed_redis resource. If this capability is not exposed by the provider, terraform plan will fail before deployment begins.
    2. Since the failure occurs during terraform plan, the private endpoint configuration is unlikely to be the root cause.

    Could you please share:

    • The exact terraform plan error message
    • The version of the azurerm Terraform provider you are using
    • The complete azurerm_managed_redis resource block (especially the default_database section)

    That will help determine whether this is a provider limitation or a configuration issue.

  2. Pilladi Padma Sai Manisha 10,190 Reputation points Microsoft External Staff Moderator

    Hi @AB, Anand
    Following up to see if the below answer was helpful. If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Sign in to comment

2 answers

  1. AB, Anand 0 Reputation points

    I have done the fix by using the below snippet

    resource "azurerm_managed_redis" "redis" {
     name = local.redis_cache_name
     resource_group_name = data.azurerm_resource_group.platform.name
     location = var.location
     sku_name = "Balanced_B0"
    
     public_network_access = "Disabled"
     high_availability_enabled = true
    
     default_database {
     client_protocol = "Encrypted"
     clustering_policy = "EnterpriseCluster"
     eviction_policy = "NoEviction"
     access_keys_authentication_enabled = true
    
     module {
     name = "RediSearch"
     }
     }
    
     tags = local.default_tags
    }
    
    
    0 comments No comments

    Sign in to comment
  2. AI answer

    Terraform support for Azure Managed Redis modules is not yet exposed through the azurerm_managed_redis resource, which is why the plan fails when trying to configure default_database { module { ... } }.

    Key points from the available documentation:

    1. Azure Managed Redis supports modules such as RediSearch, RedisBloom, RedisTimeSeries, and RedisJSON, but:
      • Modules must be enabled at the time the Azure Managed Redis instance is created.
      • Modules cannot be manually loaded later.
      • Module configuration changes via FT.CONFIG are not supported; configuration must be passed as arguments via management APIs.
    2. The only documented way to configure modules programmatically today is via the Redis Enterprise database APIs (for Redis Enterprise, not the azurerm_managed_redis resource), where modules are specified as part of the modules property on the database:
      • Each module has:
        • name (for example RedisBloom, RediSearch, RedisTimeSeries)
        • args (string of configuration options, such as "ERROR_RATE 0.00 INITIAL_SIZE 400").
    3. In Terraform, this is currently documented only for the redisEnterprise/databases resource via the AzAPI provider, not for azurerm_managed_redis. The DatabaseProperties schema shows:
       modules | Optional set of redis modules to enable in this database - modules can only be added at creation time. | Module[]
       
       Module:
       - name (required)
       - args (optional)
      

    Because there is no documented default_database.module block for azurerm_managed_redis in the provided context, the failure at plan time indicates that the provider schema does not recognize that block.

    Actionable guidance based on the documentation:

    1. Use a supported resource/API for modules
      • For Redis Enterprise: use the Microsoft.Cache/redisEnterprise/databases resource (for example via Terraform AzAPI) and configure the modules array with name = "RediSearch" and any required args.
      • For Azure Managed Redis (non-Enterprise): modules must be selected in the Advanced tab when creating the instance in the portal, and there is no documented Terraform schema in the context for module selection.
    2. Remove the unsupported default_database { module { ... } } block from azurerm_managed_redis until the provider exposes a documented way to configure modules.
    3. If RediSearch is required as code, consider using Redis Enterprise with the redisEnterprise/databases resource and its modules property, as shown in the documentation.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.
Sign in to answer

Your answer