Creates a global replication group with one primary and one secondary replication group across different regions.

Terraform Template

resource "aws_elasticache_global_replication_group" "example" {
  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 = "5.0.6"
  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
  num_cache_clusters = 1
  provider = "aws.other_region"
  replication_group_id = "example-secondary"
}