Skip to content

Commit ce8681b

Browse files
authored
Merge pull request #57 from pbs/chore/valkey-support
Adding an optional engine flag, so module consumers can use Valkey as an engine
2 parents e0fd874 + 5072af9 commit ce8681b

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

README-HEADER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ More information can be found on these install methods and more in [the document
1616

1717
## Usage
1818

19-
Provisions an Elasticache Redis cluster (with Cluster Mode Disabled).
19+
Provisions an Elasticache Redis (or Valkey) cluster (with Cluster Mode Disabled).
2020

2121
> ℹ️ Note the confusing terminology around `Cluster Mode`. The `Cluster Mode` setting is a Redis feature that allows data to be sharded among nodes in a cluster, and requires some additional configuration to connect with it correctly. A Redis cluster that does not have `Cluster Mode` enabled is a set of standalone Redis nodes that have a single primary node for reading and writing and replica nodes for reading.
2222

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Use this URL for the source of the module. See the usage examples below for more details.
88

99
```hcl
10-
github.com/pbs/terraform-aws-elasticache-redis-standalone-module?ref=2.0.0
10+
github.com/pbs/terraform-aws-elasticache-redis-standalone-module?ref=x.y.z
1111
```
1212

1313
### Alternative Installation Methods
@@ -16,7 +16,7 @@ More information can be found on these install methods and more in [the document
1616

1717
## Usage
1818

19-
Provisions an Elasticache Redis cluster (with Cluster Mode Disabled).
19+
Provisions an Elasticache Redis (or Valkey) cluster (with Cluster Mode Disabled).
2020

2121
> ℹ️ Note the confusing terminology around `Cluster Mode`. The `Cluster Mode` setting is a Redis feature that allows data to be sharded among nodes in a cluster, and requires some additional configuration to connect with it correctly. A Redis cluster that does not have `Cluster Mode` enabled is a set of standalone Redis nodes that have a single primary node for reading and writing and replica nodes for reading.
2222
@@ -28,7 +28,7 @@ Integrate this module like so:
2828

2929
```hcl
3030
module "redis" {
31-
source = "github.com/pbs/terraform-aws-elasticache-redis-standalone-module?ref=2.0.0"
31+
source = "github.com/pbs/terraform-aws-elasticache-redis-standalone-module?ref=x.y.z"
3232
3333
# Tagging Parameters
3434
organization = var.organization
@@ -44,7 +44,7 @@ module "redis" {
4444

4545
If this repo is added as a subtree, then the version of the module should be close to the version shown here:
4646

47-
`2.0.0`
47+
`x.y.z`
4848

4949
Note, however that subtrees can be altered as desired within repositories.
5050

@@ -107,6 +107,7 @@ No modules.
107107
| <a name="input_dns_ttl"></a> [dns\_ttl](#input\_dns\_ttl) | TTL for DNS records. | `number` | `300` | no |
108108
| <a name="input_egress_cidr_blocks"></a> [egress\_cidr\_blocks](#input\_egress\_cidr\_blocks) | List of CIDR blocks to assign to the egress rule of the security group. If null, `egress_security_group_ids` must be used. | `list(string)` | <pre>[<br> "10.0.0.0/8"<br>]</pre> | no |
109109
| <a name="input_egress_source_sg_id"></a> [egress\_source\_sg\_id](#input\_egress\_source\_sg\_id) | List of security group ID to assign to the egress rule of the security group. If null, `egress_cidr_blocks` must be used. | `string` | `null` | no |
110+
| <a name="input_engine"></a> [engine](#input\_engine) | The engine to use ('valkey' or 'redis') | `string` | `"redis"` | no |
110111
| <a name="input_engine_version"></a> [engine\_version](#input\_engine\_version) | Version number of the cache engine to be used. If not set, defaults to the latest version. See Describe Cache Engine Versions in the AWS Documentation for supported versions. When engine is redis and the version is 6 or higher, the major and minor version can be set, e.g., 6.2, or the minor version can be unspecified which will use the latest version at creation time, e.g., 6.x. Otherwise, specify the full version desired, e.g., 5.0.6. | `string` | `null` | no |
111112
| <a name="input_final_snapshot_identifier"></a> [final\_snapshot\_identifier](#input\_final\_snapshot\_identifier) | Name of your final cluster snapshot. If omitted, no final snapshot will be made. | `string` | `null` | no |
112113
| <a name="input_global_replication_group_id"></a> [global\_replication\_group\_id](#input\_global\_replication\_group\_id) | The ID of the global replication group to which this replication group should belong. If this parameter is specified, the replication group is added to the specified global replication group as a secondary replication group; otherwise, the replication group is not part of any global replication group. If global\_replication\_group\_id is set, the num\_node\_groups parameter cannot be set. | `string` | `null` | no |

locals.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ locals {
2424

2525
automatic_failover_enabled = var.automatic_failover_enabled != null ? var.automatic_failover_enabled : var.nodes >= 2
2626

27-
engine = "redis"
28-
2927
creator = "terraform"
3028

3129
defaulted_tags = merge(

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ resource "aws_elasticache_replication_group" "replication_group" {
88
auto_minor_version_upgrade = var.auto_minor_version_upgrade
99
automatic_failover_enabled = local.automatic_failover_enabled
1010
data_tiering_enabled = var.data_tiering_enabled
11-
engine = local.engine
11+
engine = var.engine
1212
engine_version = var.engine_version
1313
final_snapshot_identifier = var.final_snapshot_identifier
1414
global_replication_group_id = var.global_replication_group_id

optional.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ variable "auto_minor_version_upgrade" {
2222
type = bool
2323
}
2424

25+
variable "engine" {
26+
description = "The engine to use ('valkey' or 'redis')"
27+
default = "redis"
28+
type = string
29+
validation {
30+
condition = contains(["redis", "valkey"], var.engine)
31+
error_message = "Engine must be 'redis' or 'valkey'"
32+
}
33+
}
34+
2535
variable "engine_version" {
2636
description = "Version number of the cache engine to be used. If not set, defaults to the latest version. See Describe Cache Engine Versions in the AWS Documentation for supported versions. When engine is redis and the version is 6 or higher, the major and minor version can be set, e.g., 6.2, or the minor version can be unspecified which will use the latest version at creation time, e.g., 6.x. Otherwise, specify the full version desired, e.g., 5.0.6."
2737
default = null

0 commit comments

Comments
 (0)