amazon-web-services - 使用 aws_elasticache_replication_group 获取 Terraform 的终端节点

标签 amazon-web-services terraform amazon-elasticache redis-cluster

我有一个我认为是带有 Redis 的 AWS ElastiCache 的简单 Terraform 配置:

resource "aws_elasticache_replication_group" "my_replication_group" {
  replication_group_id          = "my-rep-group",
  replication_group_description = "eln00b"

  node_type                     = "cache.m4.large"
  port                          = 6379
  parameter_group_name          = "default.redis5.0.cluster.on"

  snapshot_retention_limit      = 1
  snapshot_window               = "00:00-05:00"

  subnet_group_name             = "${aws_elasticache_subnet_group.my_subnet_group.name}"

  automatic_failover_enabled    = true

  cluster_mode {
    num_node_groups             = 1
    replicas_per_node_group     = 1
  }
}

我尝试使用以下方式定义端点输出:

output "my_cache" {
  value = "${aws_elasticache_replication_group.my_replication_group.primary_endpoint_address}"
}

当我通过 terragrunt 运行应用时,我得到:

Error: Error running plan: 1 error(s) occurred:

module.mod.output.my_cache: Resource 'aws_elasticache_replication_group.my_replication_group' does not have attribute 'primary_endpoint_address' for variable 'aws_elasticache_replication_group.my_replication_group.primary_endpoint_address'

我在这里做错了什么?

最佳答案

primary_endpoint_address 属性仅适用于非集群模式 Redis 复制组,如 docs 中所述。 :

primary_endpoint_address - (Redis only) The address of the endpoint for the primary node in the replication group, if the cluster mode is disabled.

使用集群模式时,您应该使用 configuration_endpoint_address而是连接到 Redis 集群。

关于amazon-web-services - 使用 aws_elasticache_replication_group 获取 Terraform 的终端节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54411366/

相关文章:

node.js - 将 ElastiCache 连接到 Elastic Beanstalk 实例

java - 遵循 AWS 教程时对 UnknownResourceException 进行故障排除

amazon-web-services - amazon s3 中的 CSV 文件到 amazon SQL Server rds

reactjs - 如何在AWS中API网关和React应用程序之间启用CORS策略?

terraform - 如何使用 Terraform 配置启动远程服务?

amazon-web-services - 为多个区域中的 ElastiCache 集群指定 ARN

amazon-web-services - 无法生成新的 lambda 实例时触发器是否丢失?

amazon-web-services - terraform 可以复制 s3 存储桶的内容吗?

amazon-web-services - terraform中aws_iam_user_login_profile的PGP key

amazon-web-services - EC2 实例无法访问 elasticache