Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/cache/redis/.test/common/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ module testDeployment '../../main.bicep' = {
enableNonSslPort: true
lock: 'CanNotDelete'
minimumTlsVersion: '1.2'
zoneRedundant: true
zones: [ 1, 2 ]
privateEndpoints: [
{
privateDnsZoneGroup: {
Expand Down
16 changes: 16 additions & 0 deletions modules/cache/redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ This module deploys a Redis Cache.
| `tags` | object | `{object}` | | Tags of the resource. |
| `tenantSettings` | object | `{object}` | | A dictionary of tenant settings. |
| `userAssignedIdentities` | object | `{object}` | | The ID(s) to assign to the resource. |
| `zoneRedundant` | bool | `True` | | When true, replicas will be provisioned in availability zones specified in the zones parameter. |
| `zones` | array | `[]` | | If the zoneRedundant parameter is true, replicas will be provisioned in the availability zones specified here. Otherwise, the service will choose where replicas are deployed. |


### Parameter Usage: `roleAssignments`
Expand Down Expand Up @@ -404,6 +406,11 @@ module redis './cache/redis/main.bicep' = {
tags: {
resourceType: 'Redis Cache'
}
zoneRedundant: true
zones: [
1
2
]
}
}
```
Expand Down Expand Up @@ -494,6 +501,15 @@ module redis './cache/redis/main.bicep' = {
"value": {
"resourceType": "Redis Cache"
}
},
"zoneRedundant": {
"value": true
},
"zones": {
"value": [
1,
2
]
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion modules/cache/redis/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ param subnetId string = ''
@description('Optional. A dictionary of tenant settings.')
param tenantSettings object = {}

@description('Optional. When true, replicas will be provisioned in availability zones specified in the zones parameter.')
param zoneRedundant bool = true

@description('Optional. If the zoneRedundant parameter is true, replicas will be provisioned in the availability zones specified here. Otherwise, the service will choose where replicas are deployed.')
param zones array = []

@description('Optional. Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible.')
param privateEndpoints array = []

Expand Down Expand Up @@ -137,6 +143,8 @@ param diagnosticMetricsToEnable array = [
@description('Optional. Enable telemetry via a Globally Unique Identifier (GUID).')
param enableDefaultTelemetry bool = true

var availabilityZones = skuName == 'Premium' ? zoneRedundant ? !empty(zones) ? zones : pickZones('Microsoft.Cache', 'redis', location, 3) : [] : []

var diagnosticsLogsSpecified = [for category in filter(diagnosticLogCategoriesToEnable, item => item != 'allLogs'): {
category: category
enabled: true
Expand Down Expand Up @@ -211,7 +219,7 @@ resource redisCache 'Microsoft.Cache/redis@2021-06-01' = {
subnetId: !empty(subnetId) ? subnetId : null
tenantSettings: tenantSettings
}
zones: skuName == 'Premium' ? pickZones('Microsoft.Cache', 'redis', location, 1) : null
zones: availabilityZones
}

resource redisCache_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock)) {
Expand Down