Skip to content

Commit

Permalink
feat(elasticache-redis): add engine input for valkey support (cloudpo…
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode authored Oct 30, 2024
1 parent 27ef316 commit 577f163
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ components:
num_replicas: 1
num_shards: 0
replicas_per_shard: 0
engine: "redis"
engine_version: 6.0.5
instance_type: cache.t2.small
parameters:
Expand Down Expand Up @@ -68,6 +69,9 @@ components:
value: lK
```

The `engine` can either be `redis` or `valkey`. For more information, see
[why aws supports valkey](https://aws.amazon.com/blogs/opensource/why-aws-supports-valkey/).

<!-- prettier-ignore-start -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
Expand Down Expand Up @@ -109,6 +113,7 @@ No resources.
| <a name="input_at_rest_encryption_enabled"></a> [at\_rest\_encryption\_enabled](#input\_at\_rest\_encryption\_enabled) | Enable encryption at rest | `bool` | n/a | yes |
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
| <a name="input_auth_token_enabled"></a> [auth\_token\_enabled](#input\_auth\_token\_enabled) | Enable auth token | `bool` | `true` | no |
| <a name="input_auto_minor_version_upgrade"></a> [auto\_minor\_version\_upgrade](#input\_auto\_minor\_version\_upgrade) | Specifies whether minor version engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window. Only supported if the engine version is 6 or higher. | `bool` | `false` | no |
| <a name="input_automatic_failover_enabled"></a> [automatic\_failover\_enabled](#input\_automatic\_failover\_enabled) | Enable automatic failover | `bool` | n/a | yes |
| <a name="input_availability_zones"></a> [availability\_zones](#input\_availability\_zones) | Availability zone IDs | `list(string)` | `[]` | no |
| <a name="input_cloudwatch_metric_alarms_enabled"></a> [cloudwatch\_metric\_alarms\_enabled](#input\_cloudwatch\_metric\_alarms\_enabled) | Boolean flag to enable/disable CloudWatch metrics alarms | `bool` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module "redis_clusters" {
num_replicas = lookup(each.value, "num_replicas", 1)
num_shards = lookup(each.value, "num_shards", 0)
replicas_per_shard = lookup(each.value, "replicas_per_shard", 0)
engine = lookup(each.value, "engine", "redis")
engine_version = each.value.engine_version
create_parameter_group = lookup(each.value, "create_parameter_group", true)
parameters = lookup(each.value, "parameters", null)
Expand Down
3 changes: 2 additions & 1 deletion src/modules/redis_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ locals {

module "redis" {
source = "cloudposse/elasticache-redis/aws"
version = "1.4.1"
version = "1.7.0"

name = var.cluster_name

Expand All @@ -29,6 +29,7 @@ module "redis" {
cluster_mode_replicas_per_node_group = var.replicas_per_shard
cluster_size = var.num_replicas
dns_subdomain = var.dns_subdomain
engine = var.engine
engine_version = var.engine_version
family = var.cluster_attributes.family
instance_type = var.instance_type
Expand Down
8 changes: 7 additions & 1 deletion src/modules/redis_cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ variable "create_parameter_group" {
description = "Whether new parameter group should be created. Set to false if you want to use existing parameter group"
}

variable "engine" {
type = string
default = "redis"
description = "Name of the cache engine to use: either `redis` or `valkey`"
}

variable "engine_version" {
type = string
description = "Redis Version"
description = "Version of the cache engine to use"
default = "6.0.5"
}

Expand Down

0 comments on commit 577f163

Please sign in to comment.