Terraform rejects the ElastiCache Redis engine_version
Engine_version: Redis versions must match <major>.x when using version 6 or higher, or <major>.<minor>.<bug-fix>Short answer
For ElastiCache Redis the provider accepts a different engine_version format per major version. Version 7 or higher takes major and minor, such as 7.2. Version 6 takes 6.2 or 6.x. Only older versions take the full number such as 5.0.6. Write the value in the format for your major version.
Fix it fast
1Find out which cause you have
Print the value Terraform sees for the engine version, then compare it with the format for your major version below.
grep -rn "engine_version" *.tf2Match what you see, then jump to its fix
What does the error look like?
Engine_version: Redis versions must match <major>.x when using version 6 or higher, or <major>.<minor>.<bug-fix>Redis versions must match <major>.x when using version 6 or higher
Cause 1 of 2
A full patch version is given for Redis 6 or 7
1Check
The provider documents the short forms for these versions, not the three-part number.
grep -rn "engine_version" *.tf2Fix
For 7 and higher use major.minor. For 6 use 6.2, or 6.x to take the latest 6 release at creation time.
resource "aws_elasticache_replication_group" "cache" {
replication_group_id = "app-cache"
description = "app cache"
node_type = "cache.t4g.small"
engine = "redis"
engine_version = "7.2"
}3Verify
Validate and plan the change.
terraform validate
terraform planConfirmed by raw.githubusercontent.com
Cause 2 of 2
The .x form is used on version 7 or higher
1Check
The .x form is documented for version 6 only. From 7 on, the provider wants major and minor.
grep -rn "engine_version" *.tf2Fix
Replace 7.x with the exact major.minor, for example 7.2.
engine_version = "7.1"3Verify
terraform plan runs without the version error.
terraform planConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Keep engine_version in one variable with a comment naming the format rules.
- Plan with apply_immediately left false unless you accept a brief restart: a change that re-creates the resource applies at once regardless.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- RaheebA consumer app shipped to both stores from one Flutter codebase on a .NET and Azure back end.
Related fixes
Servers
Status code 460 on an AWS Application Load Balancer
elb_status_code 460 in ALB access logs
A 460 is generated by the load balancer, not by your app.
3 causes, each with a fixServers
Application Load Balancer returns 504 for requests to EC2 instances
HTTPCode_ELB_504_Count
A 504 from an Application Load Balancer means it could not get an answer from a target in time.
4 causes, each with a fixServers
Apache has a certificate, but https:// does not open
No line with :443 in the output of ss -ltnp
HTTPS needs four things at once: mod_ssl loaded, Apache listening on 443, a virtual host on 443 with SSLEngine on, and a firewall that lets 443 in.
4 causes, each with a fixServers
aws emr --steps fails: Error parsing parameter, Expected '=', received 'EOF'
Error parsing parameter '--steps': Expected: '=', received: 'EOF' for input:
The AWS CLI tried to read your option as shorthand key=value pairs and ran out of text where it expected an equals sign.
3 causes, each with a fixServers
AWS CLI says you must specify a region
You must specify a region. You can also configure your region by running "aws configure".
The AWS CLI sends every request to one region and has none to use.
4 causes, each with a fixServers
docker login to Amazon ECR fails with: Cannot perform an interactive login from a non TTY device
Cannot perform an interactive login from a non TTY device
Docker asked for a password because none reached it, and a pipe or script has no keyboard to answer.
3 causes, each with a fix