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
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
## redis
## Redis

![squareops_avatar]

[squareops_avatar]: https://squareops.com/wp-content/uploads/2022/12/squareops-logo.png

### [SquareOps Technologies](https://squareops.com/) Your DevOps Partner for Accelerating cloud journey.
<br>
This module allows users to customize the deployment by providing various input variables. Users can specify the name and environment of the Redis deployment, the chart and app version, the namespace in which the Redis deployment will be created, and whether to enable Grafana monitoring. The module also allows users to set the recovery window for the AWS Secrets Manager that is used to store the Redis password.
<br><br>
This module creates a Redis master and one or more Redis slaves, depending on the specified architecture. The module creates Kubernetes services for the Redis master and slave deployments, and exposes these services as endpoints that can be used to connect to the Redis database. Users can retrieve these endpoints using the module's outputs.

## Supported Versions :

| Redis Helm Chart Version | K8s supported version |
| :-----: | :--- |
| **16.13.2** | **1.23,1.24,1.25** |

## Usage Example

```hcl
module "redis" {
source = "../../"
source = "https://github.com/sq-ia/terraform-kubernetes-redis.git"
redis_config = {
name = "skaf"
name = "redis"
values_yaml = ""
environment = "prod"
architecture = "replication"
storage_class_name = "gp2"
slave_volume_size = "10Gi"
slave_replica_count = 3
master_volume_size = "10Gi"
master_volume_size = "10Gi"
storage_class_name = "gp2"
slave_replica_count = 2
}
grafana_monitoring_enabled = true
grafana_monitoring_enabled = true
recovery_window_aws_secret = 0
}

Expand Down Expand Up @@ -73,21 +82,21 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_app_version"></a> [app\_version](#input\_app\_version) | Enter app version of application | `string` | `"6.2.7-debian-11-r11"` | no |
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Enter chart version of application | `string` | `"16.13.2"` | no |
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Set it to true to create given namespace | `string` | `true` | no |
| <a name="input_grafana_monitoring_enabled"></a> [grafana\_monitoring\_enabled](#input\_grafana\_monitoring\_enabled) | Set true to deploy redis exporter to get metrics in grafana | `bool` | `false` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Enter namespace name | `string` | `"redis"` | no |
| <a name="input_recovery_window_aws_secret"></a> [recovery\_window\_aws\_secret](#input\_recovery\_window\_aws\_secret) | Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be 0 to force deletion without recovery or range from 7 to 30 days. | `number` | `0` | no |
| <a name="input_redis_config"></a> [redis\_config](#input\_redis\_config) | Redis configurations | `any` | <pre>{<br> "architecture": "replication",<br> "environment": "",<br> "master_volume_size": "",<br> "name": "",<br> "slave_replica_count": 1,<br> "slave_volume_size": "",<br> "storage_class_name": "",<br> "values_yaml": ""<br>}</pre> | no |
| <a name="input_app_version"></a> [app\_version](#input\_app\_version) | Version of the Redis application that will be deployed. | `string` | `"6.2.7-debian-11-r11"` | no |
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Version of the chart for the Redis application that will be deployed. | `string` | `"16.13.2"` | no |
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Specify whether or not to create the namespace if it does not already exist. Set it to true to create the namespace. | `string` | `true` | no |
| <a name="input_grafana_monitoring_enabled"></a> [grafana\_monitoring\_enabled](#input\_grafana\_monitoring\_enabled) | Specify whether or not to deploy Redis exporter to collect Redis metrics for monitoring in Grafana. | `bool` | `false` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace where the Redis resources will be deployed. | `string` | `"redis"` | no |
| <a name="input_recovery_window_aws_secret"></a> [recovery\_window\_aws\_secret](#input\_recovery\_window\_aws\_secret) | Number of days that AWS Secrets Manager will wait before it can delete the secret. The value can be 0 to force deletion without recovery, or a range from 7 to 30 days. | `number` | `0` | no |
| <a name="input_redis_config"></a> [redis\_config](#input\_redis\_config) | Specify the configuration settings for Redis, including the name, environment, storage options, replication settings, and custom YAML values. | `any` | <pre>{<br> "architecture": "replication",<br> "environment": "",<br> "master_volume_size": "",<br> "name": "",<br> "slave_replica_count": 1,<br> "slave_volume_size": "",<br> "storage_class_name": "",<br> "values_yaml": ""<br>}</pre> | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_redis_master_endpoint"></a> [redis\_master\_endpoint](#output\_redis\_master\_endpoint) | Redis master pod connection endpoint |
| <a name="output_redis_port"></a> [redis\_port](#output\_redis\_port) | Redis port |
| <a name="output_redis_slave_endpoint"></a> [redis\_slave\_endpoint](#output\_redis\_slave\_endpoint) | Redis slave pod connection endpoint |
| <a name="output_redis_master_endpoint"></a> [redis\_master\_endpoint](#output\_redis\_master\_endpoint) | The endpoint for the Redis Master Service, which is the primary node in the Redis cluster responsible for handling read-write operations. |
| <a name="output_redis_port"></a> [redis\_port](#output\_redis\_port) | The port number on which Redis is running. |
| <a name="output_redis_slave_endpoint"></a> [redis\_slave\_endpoint](#output\_redis\_slave\_endpoint) | The endpoint for the Redis Slave Service, which is a secondary node in the Redis cluster responsible for handling read-only operations. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Contribution & Issue Reporting
Expand Down
8 changes: 4 additions & 4 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ No requirements.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_redis"></a> [redis](#module\_redis) | ../../ | n/a |
| <a name="module_redis"></a> [redis](#module\_redis) | https://github.com/sq-ia/terraform-kubernetes-redis.git | n/a |

## Resources

Expand All @@ -38,7 +38,7 @@ No inputs.

| Name | Description |
|------|-------------|
| <a name="output_redis_master_endpoint"></a> [redis\_master\_endpoint](#output\_redis\_master\_endpoint) | Redis master pod connection endpoint |
| <a name="output_redis_port"></a> [redis\_port](#output\_redis\_port) | Redis port |
| <a name="output_redis_slave_endpoint"></a> [redis\_slave\_endpoint](#output\_redis\_slave\_endpoint) | Redis slave pod connection endpoint |
| <a name="output_redis_master_endpoint"></a> [redis\_master\_endpoint](#output\_redis\_master\_endpoint) | The endpoint for the Redis Master Service, which is the primary node in the Redis cluster responsible for handling read-write operations. |
| <a name="output_redis_port"></a> [redis\_port](#output\_redis\_port) | The port number on which Redis is running. |
| <a name="output_redis_slave_endpoint"></a> [redis\_slave\_endpoint](#output\_redis\_slave\_endpoint) | The endpoint for the Redis Slave Service, which is a secondary node in the Redis cluster responsible for handling read-only operations. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 7 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
locals {
name = "redis"
region = "us-east-2"
name = "skaf"
environment = "prod"
additional_tags = {
Owner = "organization_name"
Expires = "Never"
Department = "Engineering"
}
}

module "redis" {
source = "../../"
source = "https://github.com/sq-ia/terraform-kubernetes-redis.git"
redis_config = {
name = local.name
values_yaml = file("./helm/values.yaml")
Expand Down
6 changes: 3 additions & 3 deletions examples/complete/output.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
output "redis_port" {
value = "6379"
description = "Redis port"
description = "The port number on which Redis is running."
}

output "redis_master_endpoint" {
value = module.redis.redis_master_endpoint
description = "Redis master pod connection endpoint"
description = "The endpoint for the Redis Master Service, which is the primary node in the Redis cluster responsible for handling read-write operations."
}

output "redis_slave_endpoint" {
value = module.redis.redis_slave_endpoint
description = "Redis slave pod connection endpoint"
description = "The endpoint for the Redis Slave Service, which is a secondary node in the Redis cluster responsible for handling read-only operations."
}
4 changes: 3 additions & 1 deletion examples/complete/provider.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
provider "aws" {
region = local.region
default_tags {
tags = local.additional_tags
}
}


data "aws_eks_cluster" "cluster" {
name = ""
}
Expand Down
4 changes: 2 additions & 2 deletions helm/values/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ master:
## - "--maxmemory-policy volatile-ttl"
## - "--repl-backlog-size 1024mb"
##
extraFlags:
extraFlags:
- "--maxmemory 1024mb"
## @param master.extraEnvVars Array with extra environment variables to add to Redis&reg; master nodes
## e.g:
Expand Down Expand Up @@ -547,7 +547,7 @@ replica:
## - "--maxmemory-policy volatile-ttl"
## - "--repl-backlog-size 1024mb"
##
extraFlags:
extraFlags:
- "--maxmemory 1024mb"
## @param replica.extraEnvVars Array with extra environment variables to add to Redis&reg; replicas nodes
## e.g:
Expand Down
6 changes: 3 additions & 3 deletions output.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
output "redis_port" {
value = "6379"
description = "Redis port"
description = "The port number on which Redis is running."
}

output "redis_master_endpoint" {
value = "redis-master.${var.namespace}.svc.cluster.local"
description = "Redis master pod connection endpoint"
description = "The endpoint for the Redis Master Service, which is the primary node in the Redis cluster responsible for handling read-write operations."
}

output "redis_slave_endpoint" {
value = "redis-replicas.${var.namespace}.svc.cluster.local"
description = "Redis slave pod connection endpoint"
description = "The endpoint for the Redis Slave Service, which is a secondary node in the Redis cluster responsible for handling read-only operations."
}
14 changes: 7 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,41 @@ variable "redis_config" {
storage_class_name = ""
values_yaml = ""
}
description = "Redis configurations"
description = "Specify the configuration settings for Redis, including the name, environment, storage options, replication settings, and custom YAML values."
}

variable "chart_version" {
type = string
default = "16.13.2"
description = "Enter chart version of application"
description = "Version of the chart for the Redis application that will be deployed."
}

variable "app_version" {
type = string
default = "6.2.7-debian-11-r11"
description = "Enter app version of application"
description = "Version of the Redis application that will be deployed."
}

variable "namespace" {
type = string
default = "redis"
description = "Enter namespace name"
description = "Namespace where the Redis resources will be deployed."
}

variable "grafana_monitoring_enabled" {
type = bool
default = false
description = "Set true to deploy redis exporter to get metrics in grafana"
description = "Specify whether or not to deploy Redis exporter to collect Redis metrics for monitoring in Grafana."
}

variable "recovery_window_aws_secret" {
default = 0
type = number
description = "Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be 0 to force deletion without recovery or range from 7 to 30 days."
description = "Number of days that AWS Secrets Manager will wait before it can delete the secret. The value can be 0 to force deletion without recovery, or a range from 7 to 30 days."
}

variable "create_namespace" {
type = string
description = "Set it to true to create given namespace"
description = "Specify whether or not to create the namespace if it does not already exist. Set it to true to create the namespace."
default = true
}