Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

Terraform rejects the ElastiCache Redis engine_version

ErrorEngine_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.

  • Applies to Terraform 1.9, AWS provider 5
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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" *.tf
  2. 2Match what you see, then jump to its fix

    1. 1engine_version looks like 6.2.6 or 7.2.1A full patch version is given for Redis 6 or 7Fix
    2. 2engine_version looks like 7.xThe .x form is used on version 7 or higherFix

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" *.tf

2Fix

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 plan

Confirmed by raw.githubusercontent.com

Did this fix it?

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" *.tf

2Fix

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 plan

Confirmed by raw.githubusercontent.com

Did this fix it?

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:

Related fixes

Servers

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 fix

Servers

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.