Unable to deploy module in Azure Managed Redis through terraform
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]
}
-
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:
- The
moduledefinition is incomplete:
default_database { module = { name = } }nameis empty, which would cause validation to fail.- Please verify whether your current
azurermprovider version supports configuring Redis modules (such as RediSearch) through theazurerm_managed_redisresource. If this capability is not exposed by the provider,terraform planwill fail before deployment begins. - 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 planerror message - The version of the
azurermTerraform provider you are using - The complete
azurerm_managed_redisresource block (especially thedefault_databasesection)
That will help determine whether this is a provider limitation or a configuration issue.
- The
-
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 clickAccept AnswerandYesfor was this answer helpful. And, if you have any further query do let us know.
Sign in to comment
2 answers
-
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 } -
AI answer
Terraform support for Azure Managed Redis modules is not yet exposed through the
azurerm_managed_redisresource, which is why the plan fails when trying to configuredefault_database { module { ... } }.Key points from the available documentation:
- 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.CONFIGare not supported; configuration must be passed as arguments via management APIs.
- The only documented way to configure modules programmatically today is via the Redis Enterprise database APIs (for Redis Enterprise, not the
azurerm_managed_redisresource), where modules are specified as part of themodulesproperty on the database:- Each module has:
-
name(for exampleRedisBloom,RediSearch,RedisTimeSeries) -
args(string of configuration options, such as"ERROR_RATE 0.00 INITIAL_SIZE 400").
-
- Each module has:
- In Terraform, this is currently documented only for the
redisEnterprise/databasesresource via the AzAPI provider, not forazurerm_managed_redis. TheDatabasePropertiesschema 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.moduleblock forazurerm_managed_redisin the provided context, the failure at plan time indicates that the provider schema does not recognize that block.Actionable guidance based on the documentation:
- Use a supported resource/API for modules
- For Redis Enterprise: use the
Microsoft.Cache/redisEnterprise/databasesresource (for example via Terraform AzAPI) and configure themodulesarray withname = "RediSearch"and any requiredargs. - 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.
- For Redis Enterprise: use the
- Remove the unsupported
default_database { module { ... } }block fromazurerm_managed_redisuntil the provider exposes a documented way to configure modules. - If RediSearch is required as code, consider using Redis Enterprise with the
redisEnterprise/databasesresource and itsmodulesproperty, as shown in the documentation.
References:
- Use Redis modules with Azure Managed Redis
- Microsoft.Cache redisEnterprise/databases 2020-10-01-preview (deployment-language-terraform)
- Microsoft.Cache redis 2023-08-01 (deployment-language-terraform)
- Microsoft.Cache redis (deployment-language-terraform)
- Microsoft.Cache redis 2020-06-01 (deployment-language-terraform)
- Microsoft.Cache Redis 2015-08-01 (deployment-language-terraform)
- Microsoft.Cache Redis 2016-04-01 (deployment-language-terraform)
- Stuck in Creating / Failed provisioning Redis Cache - Microsoft Q&A
- Azure Deployment Takes 70 Minutes to Fail with Obscure Error - Microsoft Q&A
- My app freeze when I am trying to select a language - Microsoft Q&A
- Deployed Claude and getting API deployment resource is not ready even though it has been an hour - Microsoft Q&A
- https://learn.microsoft.com/en-us/answers/questions/ask/?wt.mc_id=pcs_inproduct_azportal_caseask&portal=azure&context=sso&source=azure-portal Unable to access this even after accesses - Microsoft Q&A
AI-generated content may be incorrect. Read our transparency notes for more information. - Azure Managed Redis supports modules such as RediSearch, RedisBloom, RedisTimeSeries, and RedisJSON, but:
