diff --git a/README.md b/README.md
index 68d8fe2..39543fa 100644
--- a/README.md
+++ b/README.md
@@ -241,10 +241,11 @@ Available targets:
| [egress\_cidr\_blocks](#input\_egress\_cidr\_blocks) | DEPRECATED: Use `allow_all_egress` and `additional_security_group_rules` instead.
Historical description: Outbound traffic address.
Historical default: ["0.0.0.0/0"] | `list(any)` | `null` | no |
| [elasticache\_subnet\_group\_name](#input\_elasticache\_subnet\_group\_name) | Subnet group name for the ElastiCache instance | `string` | `""` | no |
| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
-| [engine\_version](#input\_engine\_version) | Redis engine version | `string` | `"4.0.10"` | no |
+| [engine](#input\_engine) | Name of the cache engine | `string` | `"redis"` | no |
+| [engine\_version](#input\_engine\_version) | Version number of the cache engine | `string` | `"4.0.10"` | no |
| [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| [existing\_security\_groups](#input\_existing\_security\_groups) | DEPRECATED: Use `associated_security_group_ids` instead.
Historical description: List of existing Security Group IDs to place the cluster into.
Set `use_existing_security_groups` to `true` to enable using `existing_security_groups` as Security Groups for the cluster. | `list(string)` | `[]` | no |
-| [family](#input\_family) | Redis family | `string` | `"redis4.0"` | no |
+| [family](#input\_family) | The family of the ElastiCache parameter group | `string` | `"redis4.0"` | no |
| [final\_snapshot\_identifier](#input\_final\_snapshot\_identifier) | The name of your final node group (shard) snapshot. ElastiCache creates the snapshot from the primary node in the cluster. If omitted, no final snapshot will be made. | `string` | `null` | no |
| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no |
| [inline\_rules\_enabled](#input\_inline\_rules\_enabled) | NOT RECOMMENDED. Create rules "inline" instead of as separate `aws_security_group_rule` resources.
See [#20046](https://github.com/hashicorp/terraform-provider-aws/issues/20046) for one of several issues with inline rules.
See [this post](https://github.com/hashicorp/terraform-provider-aws/pull/9032#issuecomment-639545250) for details on the difference between inline rules and rule resources. | `bool` | `false` | no |
@@ -265,7 +266,7 @@ Available targets:
| [parameter](#input\_parameter) | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another |
list(object({
name = string
value = string
}))
| `[]` | no |
| [parameter\_group\_description](#input\_parameter\_group\_description) | Managed by Terraform | `string` | `null` | no |
| [parameter\_group\_name](#input\_parameter\_group\_name) | Override the default parameter group name | `string` | `null` | no |
-| [port](#input\_port) | Redis port | `number` | `6379` | no |
+| [port](#input\_port) | Port number on which the cache nodes will accept connections | `number` | `6379` | no |
| [preserve\_security\_group\_id](#input\_preserve\_security\_group\_id) | When `false` and `create_before_destroy` is `true`, changes to security group rules
cause a new security group to be created with the new rules, and the existing security group is then
replaced with the new one, eliminating any service interruption.
When `true` or when changing the value (from `false` to `true` or from `true` to `false`),
existing security group rules will be deleted before new ones are created, resulting in a service interruption,
but preserving the security group itself.
**NOTE:** Setting this to `true` does not guarantee the security group will never be replaced,
it only keeps changes to the security group rules from triggering a replacement.
See the README for further discussion. | `bool` | `false` | no |
| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| [replication\_group\_id](#input\_replication\_group\_id) | Replication group ID with the following constraints:
A name must contain from 1 to 20 alphanumeric characters or hyphens.
The first character must be a letter.
A name cannot end with a hyphen or contain two consecutive hyphens. | `string` | `""` | no |
diff --git a/docs/terraform.md b/docs/terraform.md
index 63fbaab..8db3bea 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -69,10 +69,11 @@
| [egress\_cidr\_blocks](#input\_egress\_cidr\_blocks) | DEPRECATED: Use `allow_all_egress` and `additional_security_group_rules` instead.
Historical description: Outbound traffic address.
Historical default: ["0.0.0.0/0"] | `list(any)` | `null` | no |
| [elasticache\_subnet\_group\_name](#input\_elasticache\_subnet\_group\_name) | Subnet group name for the ElastiCache instance | `string` | `""` | no |
| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
-| [engine\_version](#input\_engine\_version) | Redis engine version | `string` | `"4.0.10"` | no |
+| [engine](#input\_engine) | Name of the cache engine | `string` | `"redis"` | no |
+| [engine\_version](#input\_engine\_version) | Version number of the cache engine | `string` | `"4.0.10"` | no |
| [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| [existing\_security\_groups](#input\_existing\_security\_groups) | DEPRECATED: Use `associated_security_group_ids` instead.
Historical description: List of existing Security Group IDs to place the cluster into.
Set `use_existing_security_groups` to `true` to enable using `existing_security_groups` as Security Groups for the cluster. | `list(string)` | `[]` | no |
-| [family](#input\_family) | Redis family | `string` | `"redis4.0"` | no |
+| [family](#input\_family) | The family of the ElastiCache parameter group | `string` | `"redis4.0"` | no |
| [final\_snapshot\_identifier](#input\_final\_snapshot\_identifier) | The name of your final node group (shard) snapshot. ElastiCache creates the snapshot from the primary node in the cluster. If omitted, no final snapshot will be made. | `string` | `null` | no |
| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no |
| [inline\_rules\_enabled](#input\_inline\_rules\_enabled) | NOT RECOMMENDED. Create rules "inline" instead of as separate `aws_security_group_rule` resources.
See [#20046](https://github.com/hashicorp/terraform-provider-aws/issues/20046) for one of several issues with inline rules.
See [this post](https://github.com/hashicorp/terraform-provider-aws/pull/9032#issuecomment-639545250) for details on the difference between inline rules and rule resources. | `bool` | `false` | no |
@@ -93,7 +94,7 @@
| [parameter](#input\_parameter) | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | list(object({
name = string
value = string
}))
| `[]` | no |
| [parameter\_group\_description](#input\_parameter\_group\_description) | Managed by Terraform | `string` | `null` | no |
| [parameter\_group\_name](#input\_parameter\_group\_name) | Override the default parameter group name | `string` | `null` | no |
-| [port](#input\_port) | Redis port | `number` | `6379` | no |
+| [port](#input\_port) | Port number on which the cache nodes will accept connections | `number` | `6379` | no |
| [preserve\_security\_group\_id](#input\_preserve\_security\_group\_id) | When `false` and `create_before_destroy` is `true`, changes to security group rules
cause a new security group to be created with the new rules, and the existing security group is then
replaced with the new one, eliminating any service interruption.
When `true` or when changing the value (from `false` to `true` or from `true` to `false`),
existing security group rules will be deleted before new ones are created, resulting in a service interruption,
but preserving the security group itself.
**NOTE:** Setting this to `true` does not guarantee the security group will never be replaced,
it only keeps changes to the security group rules from triggering a replacement.
See the README for further discussion. | `bool` | `false` | no |
| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| [replication\_group\_id](#input\_replication\_group\_id) | Replication group ID with the following constraints:
A name must contain from 1 to 20 alphanumeric characters or hyphens.
The first character must be a letter.
A name cannot end with a hyphen or contain two consecutive hyphens. | `string` | `""` | no |
diff --git a/main.tf b/main.tf
index 418b076..2ecd728 100644
--- a/main.tf
+++ b/main.tf
@@ -176,6 +176,7 @@ resource "aws_elasticache_replication_group" "default" {
security_group_ids = local.create_security_group ? concat(local.associated_security_group_ids, [module.aws_security_group.id]) : local.associated_security_group_ids
maintenance_window = var.maintenance_window
notification_topic_arn = var.notification_topic_arn
+ engine = var.engine
engine_version = var.engine_version
at_rest_encryption_enabled = var.at_rest_encryption_enabled
transit_encryption_enabled = var.transit_encryption_enabled
@@ -221,12 +222,12 @@ resource "aws_elasticache_replication_group" "default" {
]
}
-# Create a Serverless Redis instance
+# Create a Serverless Redis/Valkey instance
resource "aws_elasticache_serverless_cache" "default" {
count = local.create_serverless_instance ? 1 : 0
name = var.replication_group_id == "" ? module.this.id : var.replication_group_id
- engine = "redis"
+ engine = var.engine
kms_key_id = var.at_rest_encryption_enabled ? var.kms_key_id : null
subnet_ids = var.subnets
diff --git a/variables.tf b/variables.tf
index 3414dff..d9ec45e 100644
--- a/variables.tf
+++ b/variables.tf
@@ -36,7 +36,7 @@ variable "cluster_size" {
variable "port" {
type = number
default = 6379
- description = "Redis port"
+ description = "Port number on which the cache nodes will accept connections"
}
variable "instance_type" {
@@ -48,7 +48,7 @@ variable "instance_type" {
variable "family" {
type = string
default = "redis4.0"
- description = "Redis family"
+ description = "The family of the ElastiCache parameter group"
}
variable "parameter" {
@@ -60,10 +60,16 @@ variable "parameter" {
description = "A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another"
}
+variable "engine" {
+ type = string
+ default = "redis"
+ description = "Name of the cache engine"
+}
+
variable "engine_version" {
type = string
default = "4.0.10"
- description = "Redis engine version"
+ description = "Version number of the cache engine"
}
variable "at_rest_encryption_enabled" {