【问题标题】:Get endpoint for Terraform with aws_elasticache_replication_group使用 aws_elasticache_replication_group 获取 Terraform 的端点
【发布时间】:2019-06-22 00:12:54
【问题描述】:

我有一个我认为是带有 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 运行应用程序时,我得到:

错误:运行计划错误:发生 1 个错误:

module.mod.output.my_cache:资源“aws_elasticache_replication_group.my_replication_group”没有变量“aws_elasticache_replication_group.my_replication_group.primary_endpoint_address”的属性“primary_endpoint_address”

我在这里做错了什么?

【问题讨论】:

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


【解决方案1】:

primary_endpoint_address 属性仅适用于docs 中提到的非集群模式 Redis 复制组:

primary_endpoint_address -(仅限 Redis)复制组中主节点的端点地址(如果禁用集群模式)。

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

【讨论】:

  • 完全忽略了“如果集群模式被禁用”部分。 :duh:
猜你喜欢
  • 2020-05-06
  • 1970-01-01
  • 2018-06-01
  • 2020-04-21
  • 2019-12-02
  • 2015-01-14
  • 2022-08-16
  • 1970-01-01
  • 2021-01-02
相关资源
最近更新 更多