【问题标题】:Terraform Error: "replication_group_id": conflicts with engine_version. ( redis )Terraform 错误:“replication_group_id”:与 engine_version 冲突。 (redis)
【发布时间】:2020-10-14 02:31:39
【问题描述】:

我正在尝试使用 Redis 创建一个 aws_elasticache_replication_group

resource "aws_elasticache_cluster" "encryption-at-rest" {
  count           = 1
  cluster_id      = "${var.namespace}-${var.environment}-encryption-at-rest"
  engine          = "redis"
  engine_version  = var.engine_version
  node_type       = var.node_type
  num_cache_nodes = 1
  port            = var.redis_port
  #az_mode            = var.az_mode
  replication_group_id = aws_elasticache_replication_group.elasticache_replication_group.id
  security_group_ids   = [aws_security_group.redis_security_group.id]
  subnet_group_name    = aws_elasticache_subnet_group.default.name
  apply_immediately    = true
  tags = {
    Name = "${var.namespace}-${var.environment}-redis"
  }

}

resource "aws_elasticache_replication_group" "elasticache_replication_group" {

  automatic_failover_enabled    = false               //var.sharding_automatic_failover_enabled
  availability_zones            = ["ap-southeast-1a"] //data.terraform_remote_state.network.outputs.availability_zones
  replication_group_id          = "${var.namespace}-${var.environment}-encryption-at-rest"
  replication_group_description = "${var.namespace} ${var.environment} replication group"
  security_group_ids            = [aws_security_group.redis_security_group.id]
  subnet_group_name             = aws_elasticache_subnet_group.default.name
  node_type                     = var.node_type
  number_cache_clusters         = 1 //2
  parameter_group_name          = aws_elasticache_parameter_group.param_group.name
  port                          = var.redis_port
  at_rest_encryption_enabled    = true
  kms_key_id                    = data.aws_kms_alias.kms_redis.target_key_arn
  apply_immediately             = true
}

resource "aws_elasticache_parameter_group" "param_group" {
  name   = "${var.namespace}-${var.environment}-params"
  family = "redis5.0"
}

但我收到以下错误,告诉我复制组需要一个 redis4.0 参数组。错误:

aws_security_group_rule.redis_ingress[0]: Refreshing state... [id=sgrule-3474516270]
aws_security_group_rule.redis_ingress[1]: Refreshing state... [id=sgrule-2582511137]
aws_elasticache_replication_group.elasticache_replication_group: Refreshing state... [id=cbpl-uat-encryption-at-rest]

Error: "replication_group_id": conflicts with engine_version

  on redis.tf line 1, in resource "aws_elasticache_cluster" "encryption-at-rest":
   1: resource "aws_elasticache_cluster" "encryption-at-rest" {


Releasing state lock. This may take a few moments...

【问题讨论】:

  • var.engine_version的值是多少
  • 您的问题标题显示您收到关于 replication_group_idengine_version 冲突的错误,并且包含的​​错误与此匹配。但是,您通过说“复制组需要一个 redis4.0 参数组”来引入错误。您到底有哪个错误?我已经根据问题标题和错误输出进行了回答,但您应该澄清/解决这个问题。

标签: amazon-web-services terraform terraform-provider-aws amazon-elasticache


【解决方案1】:

aws_elasticache_cluster resource docs 这么说:

  • replication_group_id - (可选)复制组的 ID 这个集群应该属于哪个。如果指定了该参数,则 集群作为只读副本添加到指定的复制组; 否则,集群是独立的主集群,不属于任何集群 复制组。

  • engine – (除非提供replication_group_id,否则为必填项)名称 用于此缓存集群的缓存引擎。有效值 此参数为memcachedredis

如果您要将其加入复制组,则引擎必须与复制组的引擎类型匹配,因此不应在 aws_elasticache_cluster 上设置它。

【讨论】:

    猜你喜欢
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 2016-09-17
    • 2017-07-25
    • 2018-04-05
    • 2018-08-24
    • 1970-01-01
    相关资源
    最近更新 更多