Skip to content

Commit b50d374

Browse files
authored
Merge pull request #1 from kumarvna/develop
final configuration for v1.0
2 parents 90f4bea + ef34b68 commit b50d374

File tree

26 files changed

+2038
-2
lines changed

26 files changed

+2038
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# .tfstate files
55
*.tfstate
66
*.tfstate.*
7+
*.terraform.lock.hcl*
78

89
# Crash log files
910
crash.log

README.md

Lines changed: 257 additions & 2 deletions
Large diffs are not rendered by default.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Azure Cache for Redis Terraform module
2+
3+
Azure Cache for Redis provides an in-memory data store based on the Redis software. This terraform module helps to quickly create the open-source (OSS Redis) Azure Cache for Redis.
4+
5+
## Module Usage
6+
7+
### Azure Cache for Redis with Cluster
8+
9+
```hcl
10+
module "redis" {
11+
source = "kumarvna/redis/azurerm"
12+
version = "1.0.0"
13+
14+
# By default, this module will create a resource group
15+
# proivde a name to use an existing resource group and set the argument
16+
# to `create_resource_group = false` if you want to existing resoruce group.
17+
# If you use existing resrouce group location will be the same as existing RG.
18+
create_resource_group = false
19+
resource_group_name = "rg-shared-westeurope-01"
20+
location = "westeurope"
21+
22+
# Configuration to provision a Standard Redis Cache
23+
# Specify `shard_count` to create on the Redis Cluster
24+
# Add patch_schedle to this object to enable redis patching schedule
25+
redis_server_settings = {
26+
demoredischache-shared = {
27+
sku_name = "Premium"
28+
capacity = 2
29+
shard_count = 3
30+
}
31+
}
32+
33+
# MEMORY MANAGEMENT
34+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
35+
redis_configuration = {
36+
maxmemory_reserved = 2
37+
maxmemory_delta = 2
38+
maxmemory_policy = "allkeys-lru"
39+
}
40+
41+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
42+
# Azure Redis Cache access is determined based on start and end IP address range specified.
43+
# As a rule, only specific IP addresses should be granted access, and all others denied.
44+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
45+
firewall_rules = {
46+
access_to_azure = {
47+
start_ip = "1.2.3.4"
48+
end_ip = "1.2.3.4"
49+
},
50+
desktop_ip = {
51+
start_ip = "49.204.228.223"
52+
end_ip = "49.204.228.223"
53+
}
54+
}
55+
56+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
57+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
58+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
59+
60+
# Tags for Azure Resources
61+
tags = {
62+
Terraform = "true"
63+
Environment = "dev"
64+
Owner = "test-user"
65+
}
66+
}
67+
```
68+
69+
## Terraform Usage
70+
71+
To run this example you need to execute following Terraform commands
72+
73+
```hcl
74+
terraform init
75+
terraform plan
76+
terraform apply
77+
78+
```
79+
80+
Run `terraform destroy` when you don't need these resources.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
module "redis" {
2+
source = "kumarvna/redis/azurerm"
3+
version = "1.0.0"
4+
5+
# By default, this module will create a resource group
6+
# proivde a name to use an existing resource group and set the argument
7+
# to `create_resource_group = false` if you want to existing resoruce group.
8+
# If you use existing resrouce group location will be the same as existing RG.
9+
create_resource_group = false
10+
resource_group_name = "rg-shared-westeurope-01"
11+
location = "westeurope"
12+
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
16+
redis_server_settings = {
17+
demoredischache-shared = {
18+
sku_name = "Premium"
19+
capacity = 2
20+
shard_count = 3
21+
}
22+
}
23+
24+
# MEMORY MANAGEMENT
25+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
26+
redis_configuration = {
27+
maxmemory_reserved = 2
28+
maxmemory_delta = 2
29+
maxmemory_policy = "allkeys-lru"
30+
}
31+
32+
# Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
33+
# Azure Redis Cache access is determined based on start and end IP address range specified.
34+
# As a rule, only specific IP addresses should be granted access, and all others denied.
35+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
36+
firewall_rules = {
37+
access_to_azure = {
38+
start_ip = "1.2.3.4"
39+
end_ip = "1.2.3.4"
40+
},
41+
desktop_ip = {
42+
start_ip = "49.204.228.223"
43+
end_ip = "49.204.228.223"
44+
}
45+
}
46+
47+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
48+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
49+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
50+
51+
# Tags for Azure Resources
52+
tags = {
53+
Terraform = "true"
54+
Environment = "dev"
55+
Owner = "test-user"
56+
}
57+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
output "redis_cache_instance_id" {
2+
description = "The Route ID of Redis Cache Instance"
3+
value = module.redis.redis_cache_instance_id
4+
}
5+
6+
output "redis_cache_hostname" {
7+
description = "The Hostname of the Redis Instance"
8+
value = module.redis.redis_cache_hostname
9+
}
10+
11+
output "redis_cache_ssl_port" {
12+
description = "The SSL Port of the Redis Instance"
13+
value = module.redis.redis_cache_ssl_port
14+
}
15+
16+
output "redis_cache_port" {
17+
description = "The non-SSL Port of the Redis Instance"
18+
value = module.redis.redis_cache_port
19+
sensitive = true
20+
}
21+
22+
output "redis_cache_primary_access_key" {
23+
description = "The Primary Access Key for the Redis Instance"
24+
value = module.redis.redis_cache_primary_access_key
25+
sensitive = true
26+
}
27+
28+
output "redis_cache_secondary_access_key" {
29+
description = "The Secondary Access Key for the Redis Instance"
30+
value = module.redis.redis_cache_secondary_access_key
31+
sensitive = true
32+
}
33+
34+
output "redis_cache_primary_connection_string" {
35+
description = "The primary connection string of the Redis Instance."
36+
value = module.redis.redis_cache_primary_connection_string
37+
sensitive = true
38+
}
39+
40+
output "redis_cache_secondary_connection_string" {
41+
description = "The secondary connection string of the Redis Instance."
42+
value = module.redis.redis_cache_secondary_connection_string
43+
sensitive = true
44+
}
45+
46+
output "redis_configuration_maxclients" {
47+
description = "Returns the max number of connected clients at the same time."
48+
value = module.redis.redis_configuration_maxclients
49+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
variable "subnet_id" {
2+
description = "The ID of the Subnet within which the Redis Cache should be deployed. Only available when using the Premium SKU and this subnet s "
3+
default = null
4+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Azure Cache for Redis Terraform module
2+
3+
Azure Cache for Redis provides an in-memory data store based on the Redis software. This terraform module helps to quickly create the open-source (OSS Redis) Azure Cache for Redis.
4+
5+
## Module Usage
6+
7+
### Azure Cache for Redis with data persistence enabled
8+
9+
```hcl
10+
module "redis" {
11+
source = "kumarvna/redis/azurerm"
12+
version = "1.0.0"
13+
14+
# By default, this module will create a resource group
15+
# proivde a name to use an existing resource group and set the argument
16+
# to `create_resource_group = false` if you want to existing resoruce group.
17+
# If you use existing resrouce group location will be the same as existing RG.
18+
create_resource_group = false
19+
resource_group_name = "rg-shared-westeurope-01"
20+
location = "westeurope"
21+
22+
# Configuration to provision a Standard Redis Cache
23+
# Specify `shard_count` to create on the Redis Cluster
24+
# Add patch_schedle to this object to enable redis patching schedule
25+
redis_server_settings = {
26+
demoredischache-shared = {
27+
sku_name = "Premium"
28+
capacity = 2
29+
}
30+
}
31+
32+
# MEMORY MANAGEMENT
33+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
34+
redis_configuration = {
35+
maxmemory_reserved = 2
36+
maxmemory_delta = 2
37+
maxmemory_policy = "allkeys-lru"
38+
}
39+
40+
# SNAPSHOTTING - Redis data backup
41+
# Data persistence doesn't work if `shard_count` is specified. i.e. Cluster enabled.
42+
enable_data_persistence = true
43+
data_persistence_backup_frequency = 60
44+
data_persistence_backup_max_snapshot_count = 1
45+
46+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
47+
# Azure Redis Cache access is determined based on start and end IP address range specified.
48+
# As a rule, only specific IP addresses should be granted access, and all others denied.
49+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
50+
firewall_rules = {
51+
access_to_azure = {
52+
start_ip = "1.2.3.4"
53+
end_ip = "1.2.3.4"
54+
},
55+
desktop_ip = {
56+
start_ip = "49.204.228.223"
57+
end_ip = "49.204.228.223"
58+
}
59+
}
60+
61+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
62+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
63+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
64+
65+
# Tags for Azure Resources
66+
tags = {
67+
Terraform = "true"
68+
Environment = "dev"
69+
Owner = "test-user"
70+
}
71+
}
72+
```
73+
74+
## Terraform Usage
75+
76+
To run this example you need to execute following Terraform commands
77+
78+
```hcl
79+
terraform init
80+
terraform plan
81+
terraform apply
82+
83+
```
84+
85+
Run `terraform destroy` when you don't need these resources.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
module "redis" {
2+
source = "kumarvna/redis/azurerm"
3+
version = "1.0.0"
4+
5+
# By default, this module will create a resource group
6+
# proivde a name to use an existing resource group and set the argument
7+
# to `create_resource_group = false` if you want to existing resoruce group.
8+
# If you use existing resrouce group location will be the same as existing RG.
9+
create_resource_group = false
10+
resource_group_name = "rg-shared-westeurope-01"
11+
location = "westeurope"
12+
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
16+
redis_server_settings = {
17+
demoredischache-shared = {
18+
sku_name = "Premium"
19+
capacity = 2
20+
}
21+
}
22+
23+
# MEMORY MANAGEMENT
24+
# Azure Cache for Redis instances are configured with the following default Redis configuration values:
25+
redis_configuration = {
26+
maxmemory_reserved = 2
27+
maxmemory_delta = 2
28+
maxmemory_policy = "allkeys-lru"
29+
}
30+
31+
# SNAPSHOTTING - Redis data backup
32+
# Data persistence doesn't work if `shard_count` is specified. i.e. Cluster enabled.
33+
enable_data_persistence = true
34+
data_persistence_backup_frequency = 60
35+
data_persistence_backup_max_snapshot_count = 1
36+
37+
#Azure Cache for Redis firewall filter rules are used to provide specific source IP access.
38+
# Azure Redis Cache access is determined based on start and end IP address range specified.
39+
# As a rule, only specific IP addresses should be granted access, and all others denied.
40+
# "name" (ex. azure_to_azure or desktop_ip) may only contain alphanumeric characters and underscores
41+
firewall_rules = {
42+
access_to_azure = {
43+
start_ip = "1.2.3.4"
44+
end_ip = "1.2.3.4"
45+
},
46+
desktop_ip = {
47+
start_ip = "49.204.228.223"
48+
end_ip = "49.204.228.223"
49+
}
50+
}
51+
52+
# (Optional) To enable Azure Monitoring for Azure Cache for Redis
53+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
54+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
55+
56+
# Tags for Azure Resources
57+
tags = {
58+
Terraform = "true"
59+
Environment = "dev"
60+
Owner = "test-user"
61+
}
62+
}

0 commit comments

Comments
 (0)