Skip to content

Commit d9b3e24

Browse files
committed
adding private endpoints and azure diagnostics
1 parent ff2e950 commit d9b3e24

File tree

7 files changed

+408
-39
lines changed

7 files changed

+408
-39
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# terraform-azurerm-redis
22
Terraform module for Azure Cache for Redis
3+
4+
5+
Schedule maintenance for Redis. The default maintenance window is 5 hours
6+
This does not cover any maintenance done by Azure for updating the underlying platform.

examples/complete/main.tf

Lines changed: 336 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module "redis" {
2-
// source = "kumarvna/redis/azurerm"
3-
// version = "1.0.0"
4-
source = "../../"
2+
source = "kumarvna/redis/azurerm"
3+
version = "1.0.0"
54

65
# By default, this module will create a resource group
76
# proivde a name to use an existing resource group and set the argument
@@ -11,9 +10,9 @@ module "redis" {
1110
resource_group_name = "rg-shared-westeurope-01"
1211
location = "westeurope"
1312

14-
# Schedule maintenance for Redis. The default maintenance window is 5 hours
15-
# This does not cover any maintenance done by Azure for updating the underlying platform.
16-
13+
# Configuration to provision a Standard Redis Cache
14+
# Specify `shard_count` to create on the Redis Cluster
15+
# Add patch_schedle to this object to enable redis patching schedule
1716
redis_server_settings = {
1817
demoredischache-shared = {
1918
sku_name = "Premium"
@@ -28,21 +27,30 @@ module "redis" {
2827
}
2928
}
3029

31-
#Configure virtual network support for a Premium Azure Cache for Redis instance
32-
subnet_id = "/subscriptions/1e3f0eeb-2235-44cd-b3a3-dcded0861d06/resourceGroups/rg-shared-westeurope-01/providers/Microsoft.Network/virtualNetworks/vnet-shared-hub-westeurope-001/subnets/snet-appgateway"
33-
30+
# MEMORY MANAGEMENT
31+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
3432
redis_configuration = {
3533
maxmemory_reserved = 2
3634
maxmemory_delta = 2
3735
maxmemory_policy = "allkeys-lru"
3836
}
39-
/* # Redis data backup
37+
38+
# Configure virtual network support for Azure Cache for Redis instance
39+
# Only works with "Premium" SKU tier
40+
# Not applicable when private endpoint option enabled
41+
subnet_id = var.subnet_id
42+
43+
44+
# SNAPSHOTTING - Redis data backup
45+
# Data persistence doesn't work if `shard_count` is specified. i.e. Cluster enabled.
4046
enable_data_persistence = true
4147
data_persistence_backup_frequency = 60
4248
data_persistence_backup_max_snapshot_count = 1
43-
*/
44-
# Firewall Rules to allow azure and external clients and specific Ip address/ranges.
45-
# "name" may only contain alphanumeric characters and underscores
49+
50+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
51+
# Azure Redis Cache access is determined based on start and end IP address range specified.
52+
# As a rule, only specific IP addresses should be granted access, and all others denied.
53+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
4654
firewall_rules = {
4755
access_to_azure = {
4856
start_ip = "1.2.3.4"
@@ -58,12 +66,327 @@ module "redis" {
5866
# By default this will create a `privatelink.mysql.database.azure.com` DNS zone.
5967
# To use existing private DNS zone specify `existing_private_dns_zone` with valid zone name
6068
# Private endpoints doesn't work If using `subnet_id` to create redis cache inside a specified virtual network
69+
enable_private_endpoint = true
70+
virtual_network_name = "vnet-shared-hub-westeurope-001"
71+
private_subnet_address_prefix = ["10.1.5.0/29"]
72+
# existing_private_dns_zone = "demo.example.com"
73+
74+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
75+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
76+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
77+
78+
# Tags for Azure Resources
79+
tags = {
80+
Terraform = "true"
81+
Environment = "dev"
82+
Owner = "test-user"
83+
}
84+
}
85+
86+
87+
88+
89+
# simple
90+
91+
module "redis" {
92+
source = "kumarvna/redis/azurerm"
93+
version = "1.0.0"
94+
95+
# By default, this module will create a resource group
96+
# proivde a name to use an existing resource group and set the argument
97+
# to `create_resource_group = false` if you want to existing resoruce group.
98+
# If you use existing resrouce group location will be the same as existing RG.
99+
create_resource_group = false
100+
resource_group_name = "rg-shared-westeurope-01"
101+
location = "westeurope"
102+
103+
# Configuration to provision a Standard Redis Cache
104+
# Specify `shard_count` to create on the Redis Cluster
105+
# Add patch_schedle to this object to enable redis patching schedule
106+
redis_server_settings = {
107+
demoredischache-shared = {
108+
sku_name = "Premium"
109+
capacity = 2
110+
}
111+
}
112+
113+
# MEMORY MANAGEMENT
114+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
115+
redis_configuration = {
116+
maxmemory_reserved = 2
117+
maxmemory_delta = 2
118+
maxmemory_policy = "allkeys-lru"
119+
}
120+
121+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
122+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
123+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
124+
125+
# Tags for Azure Resources
126+
tags = {
127+
Terraform = "true"
128+
Environment = "dev"
129+
Owner = "test-user"
130+
}
131+
}
132+
133+
134+
# with virtual network support
135+
136+
module "redis" {
137+
source = "kumarvna/redis/azurerm"
138+
version = "1.0.0"
139+
140+
# By default, this module will create a resource group
141+
# proivde a name to use an existing resource group and set the argument
142+
# to `create_resource_group = false` if you want to existing resoruce group.
143+
# If you use existing resrouce group location will be the same as existing RG.
144+
create_resource_group = false
145+
resource_group_name = "rg-shared-westeurope-01"
146+
location = "westeurope"
147+
148+
# Configuration to provision a Standard Redis Cache
149+
# Specify `shard_count` to create on the Redis Cluster
150+
# Add patch_schedle to this object to enable redis patching schedule
151+
redis_server_settings = {
152+
demoredischache-shared = {
153+
sku_name = "Premium"
154+
capacity = 2
155+
}
156+
}
157+
158+
# MEMORY MANAGEMENT
159+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
160+
redis_configuration = {
161+
maxmemory_reserved = 2
162+
maxmemory_delta = 2
163+
maxmemory_policy = "allkeys-lru"
164+
}
165+
166+
# Configure virtual network support for Azure Cache for Redis instance
167+
# Only works with "Premium" SKU tier
168+
# Not applicable when private endpoint option enabled
169+
subnet_id = var.subnet_id
170+
171+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
172+
# Azure Redis Cache access is determined based on start and end IP address range specified.
173+
# As a rule, only specific IP addresses should be granted access, and all others denied.
174+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
175+
firewall_rules = {
176+
access_to_azure = {
177+
start_ip = "10.0.0.0"
178+
end_ip = "10.0.1.255"
179+
},
180+
desktop_ip = {
181+
start_ip = "49.204.228.223"
182+
end_ip = "49.204.228.223"
183+
}
184+
}
185+
186+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
187+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
188+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
189+
190+
# Tags for Azure Resources
191+
tags = {
192+
Terraform = "true"
193+
Environment = "dev"
194+
Owner = "test-user"
195+
}
196+
}
197+
198+
# Cluster
199+
200+
module "redis" {
201+
source = "kumarvna/redis/azurerm"
202+
version = "1.0.0"
203+
204+
# By default, this module will create a resource group
205+
# proivde a name to use an existing resource group and set the argument
206+
# to `create_resource_group = false` if you want to existing resoruce group.
207+
# If you use existing resrouce group location will be the same as existing RG.
208+
create_resource_group = false
209+
resource_group_name = "rg-shared-westeurope-01"
210+
location = "westeurope"
211+
212+
# Configuration to provision a Standard Redis Cache
213+
# Specify `shard_count` to create on the Redis Cluster
214+
# Add patch_schedle to this object to enable redis patching schedule
215+
redis_server_settings = {
216+
demoredischache-shared = {
217+
sku_name = "Premium"
218+
capacity = 2
219+
shard_count = 3
220+
}
221+
}
222+
223+
# MEMORY MANAGEMENT
224+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
225+
redis_configuration = {
226+
maxmemory_reserved = 2
227+
maxmemory_delta = 2
228+
maxmemory_policy = "allkeys-lru"
229+
}
230+
231+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
232+
# Azure Redis Cache access is determined based on start and end IP address range specified.
233+
# As a rule, only specific IP addresses should be granted access, and all others denied.
234+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
235+
firewall_rules = {
236+
access_to_azure = {
237+
start_ip = "1.2.3.4"
238+
end_ip = "1.2.3.4"
239+
},
240+
desktop_ip = {
241+
start_ip = "49.204.228.223"
242+
end_ip = "49.204.228.223"
243+
}
244+
}
245+
246+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
247+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
248+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
249+
250+
# Tags for Azure Resources
251+
tags = {
252+
Terraform = "true"
253+
Environment = "dev"
254+
Owner = "test-user"
255+
}
256+
}
257+
258+
# data persistence enabled
259+
260+
module "redis" {
261+
source = "kumarvna/redis/azurerm"
262+
version = "1.0.0"
263+
264+
# By default, this module will create a resource group
265+
# proivde a name to use an existing resource group and set the argument
266+
# to `create_resource_group = false` if you want to existing resoruce group.
267+
# If you use existing resrouce group location will be the same as existing RG.
268+
create_resource_group = false
269+
resource_group_name = "rg-shared-westeurope-01"
270+
location = "westeurope"
271+
272+
# Configuration to provision a Standard Redis Cache
273+
# Specify `shard_count` to create on the Redis Cluster
274+
# Add patch_schedle to this object to enable redis patching schedule
275+
redis_server_settings = {
276+
demoredischache-shared = {
277+
sku_name = "Premium"
278+
capacity = 2
279+
}
280+
}
281+
282+
# MEMORY MANAGEMENT
283+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
284+
redis_configuration = {
285+
maxmemory_reserved = 2
286+
maxmemory_delta = 2
287+
maxmemory_policy = "allkeys-lru"
288+
}
61289

290+
# SNAPSHOTTING - Redis data backup
291+
# Data persistence doesn't work if `shard_count` is specified. i.e. Cluster enabled.
292+
enable_data_persistence = true
293+
data_persistence_backup_frequency = 60
294+
data_persistence_backup_max_snapshot_count = 1
295+
296+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
297+
# Azure Redis Cache access is determined based on start and end IP address range specified.
298+
# As a rule, only specific IP addresses should be granted access, and all others denied.
299+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
300+
firewall_rules = {
301+
access_to_azure = {
302+
start_ip = "1.2.3.4"
303+
end_ip = "1.2.3.4"
304+
},
305+
desktop_ip = {
306+
start_ip = "49.204.228.223"
307+
end_ip = "49.204.228.223"
308+
}
309+
}
310+
311+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
312+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
313+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
314+
315+
# Tags for Azure Resources
316+
tags = {
317+
Terraform = "true"
318+
Environment = "dev"
319+
Owner = "test-user"
320+
}
321+
}
322+
323+
# Private endpoints enabled.
324+
325+
module "redis" {
326+
source = "kumarvna/redis/azurerm"
327+
version = "1.0.0"
328+
329+
# By default, this module will create a resource group
330+
# proivde a name to use an existing resource group and set the argument
331+
# to `create_resource_group = false` if you want to existing resoruce group.
332+
# If you use existing resrouce group location will be the same as existing RG.
333+
create_resource_group = false
334+
resource_group_name = "rg-shared-westeurope-01"
335+
location = "westeurope"
336+
337+
# Configuration to provision a Standard Redis Cache
338+
# Specify `shard_count` to create on the Redis Cluster
339+
# Add patch_schedle to this object to enable redis patching schedule
340+
redis_server_settings = {
341+
demoredischache-shared = {
342+
sku_name = "Premium"
343+
capacity = 2
344+
shard_count = 3
345+
zones = ["1", "2", "3"]
346+
enable_non_ssl_port = true
347+
patch_schedule = {
348+
days_of_week = "Monday"
349+
start_hour_utc = 21
350+
}
351+
}
352+
}
353+
354+
# MEMORY MANAGEMENT
355+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
356+
redis_configuration = {
357+
maxmemory_reserved = 2
358+
maxmemory_delta = 2
359+
maxmemory_policy = "allkeys-lru"
360+
}
361+
362+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
363+
# Azure Redis Cache access is determined based on start and end IP address range specified.
364+
# As a rule, only specific IP addresses should be granted access, and all others denied.
365+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
366+
firewall_rules = {
367+
access_to_azure = {
368+
start_ip = "1.2.3.4"
369+
end_ip = "1.2.3.4"
370+
},
371+
desktop_ip = {
372+
start_ip = "49.204.228.223"
373+
end_ip = "49.204.228.223"
374+
}
375+
}
376+
377+
# Creating Private Endpoint requires, VNet name and address prefix to create a subnet
378+
# By default this will create a `privatelink.mysql.database.azure.com` DNS zone.
379+
# To use existing private DNS zone specify `existing_private_dns_zone` with valid zone name
380+
# Private endpoints doesn't work If using `subnet_id` to create redis cache inside a specified virtual network
62381
enable_private_endpoint = true
63382
virtual_network_name = "vnet-shared-hub-westeurope-001"
64383
private_subnet_address_prefix = ["10.1.5.0/29"]
65384
# existing_private_dns_zone = "demo.example.com"
66385

386+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
387+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
388+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
389+
67390
# Tags for Azure Resources
68391
tags = {
69392
Terraform = "true"

0 commit comments

Comments
 (0)