Manages Redis engine versions across primary and secondary replication groups within a global replication group, using lifecycle policies to handle version synchronization.

Terraform Template

resource "aws_elasticache_global_replication_group" "example" {
  engine_version = "6.2"
  global_replication_group_id_suffix = "example"
  primary_replication_group_id = aws_elasticache_replication_group.primary.id
}

resource "aws_elasticache_replication_group" "primary" {
  description = "primary replication group"
  engine = "redis"
  engine_version = "6.0"

  lifecycle {
    ignore_changes = ["engine_version"]
  }
  node_type = "cache.m5.large"
  num_cache_clusters = 1
  replication_group_id = "example-primary"
}

resource "aws_elasticache_replication_group" "secondary" {
  description = "secondary replication group"
  global_replication_group_id = aws_elasticache_global_replication_group.example.global_replication_group_id

  lifecycle {
    ignore_changes = ["engine_version"]
  }
  num_cache_clusters = 1
  provider = "aws.other_region"
  replication_group_id = "example-secondary"
}