Skip to content

Conflict when creating Valkey cluster with Global replication #42

@Israphel

Description

@Israphel

Description

I'm trying to create a Valkey with cluster mode enabled and global replication.
I'm following the Redis global example which is the closest one I found here.

  • ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 1.6.0

  • Terraform version: 1.5.7

  • Provider version(s): 6.0.0

Reproduction Code [Required]

Steps to reproduce the behavior:

# Elasticache (us-east-1)
module "elasticache-us-east-1" {
  source   = "terraform-aws-modules/elasticache/aws"
  version  = "1.6.0"
  for_each = local.config["global"]

  replication_group_id                    = each.key
  create_primary_global_replication_group = true
  cluster_mode_enabled                    = try(each.value.cluster_mode, false)
  cluster_id                              = try(each.value.cluster_mode, false) ? each.key : null
  engine                                  = try(each.value.engine, "valkey")
  engine_version                          = each.value.version
  node_type                               = each.value.node_type
  num_cache_clusters                      = !try(each.value.cluster_mode, false) ? each.value.nodes : null
  num_node_groups                         = try(each.value.cluster_mode, false) ? each.value.nodes : null
  replicas_per_node_group                 = try(each.value.cluster_mode, false) ? each.value.replicas_per_node : null
  az_mode                                 = "cross-az"
  maintenance_window                      = "sun:05:00-sun:09:00"
  auto_minor_version_upgrade              = false
  apply_immediately                       = true
  automatic_failover_enabled              = true
  create_security_group                   = false
  security_group_ids                      = ["sg-xxxx"]
  at_rest_encryption_enabled              = true
  transit_encryption_enabled              = true
  auth_token                              = "xxxx"
  log_delivery_configuration              = {}

  # Subnet Group
  subnet_group_name        = each.key
  subnet_group_description = "Subnet group for ${each.key}"
  subnet_ids               = ["xxxx", "xxxx", "xxxx", "xxxx"]

  # Parameter Group
  create_parameter_group      = true
  parameter_group_name        = "${each.key}-${replace("${try(each.value.engine, "valkey")}${replace(each.value.version, "/\\.[\\d]+$/", "")}", ".", "")}"
  parameter_group_description = "Customized parameter group for ${each.key}"
  parameter_group_family      = "${try(each.value.engine, "valkey")}${replace(each.value.version, "/\\.[\\d]+$/", "")}"
  parameters                  = try(each.value.parameters, [])

  tags = {
    Name        = each.key
    service     = try(each.value.service_name, each.key)
    environment = local.environment
    managed_by  = "terraform"
  }
}

# Elasticache (us-west-2)
module "elasticache-us-west-2" {
  source   = "terraform-aws-modules/elasticache/aws"
  version  = "1.6.0"
  for_each = local.config["global"]

  replication_group_id        = each.key
  global_replication_group_id = module.elasticache-us-east-1[each.key].global_replication_group_id
  create_security_group       = false
  security_group_ids          = ["sg-xxx"]
  log_delivery_configuration  = {}

  # Subnet Group
  subnet_group_name        = each.key
  subnet_group_description = "Subnet group for ${each.key}"
  subnet_ids               = ["xxxx", "xxxx", "xxxx", "xxxx"]

  tags = {
    Name        = each.key
    service     = try(each.value.service_name, each.key)
    environment = local.environment
    managed_by  = "terraform"
  }

  providers = {
    aws = aws.usw2
  }
}
global:
  maldo:
    engine: valkey
    version: "8.0"
    cluster_mode: true
    nodes: 2
    replicas_per_node: 1
    node_type: cache.m7g.large

Expected behavior

I should get two replication groups.

Actual behavior

The creation of the west replication group fails due to a conflict, even tho I'm not passing engine.

Terminal Output

│ Error: Conflicting configuration arguments
│
│   with module.elasticache-us-west-2["maldo"].aws_elasticache_replication_group.this[0],
│   on .terraform/modules/elasticache-us-west-2/main.tf line 95, in resource "aws_elasticache_replication_group" "this":
│   95:   global_replication_group_id = var.global_replication_group_id
│
│ "global_replication_group_id": conflicts with engine

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions