amazon-web-services - 使用 aws_elasticache_replication_group 获取 Terraform 的端点
问题描述
我有一个我认为是带有 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”
我在这里做错了什么?
解决方案
该primary_endpoint_address
属性仅适用于文档中提到的非集群模式 Redis 复制组:
primary_endpoint_address -(仅限 Redis)复制组中主节点的端点地址(如果禁用集群模式)。
使用集群模式时,您应该使用它configuration_endpoint_address
来连接到 Redis 集群。
推荐阅读
- javascript - 使用反应路由器导航时保存数据
- elasticsearch - 当我关闭弹性搜索主节点时,这种情况是否正确?
- tensorflow - 将自定义 keras 指标输入分成两个单独的指标并找到中值误差
- android - 无法通过 Unity Remote 5 将三星 Galaxy A9 连接到 Unity
- javascript - 如何查找数组值是否在字符串中并将其删除?
- python - 如何让子进程运行一段时间,然后返回循环并等待触发器?
- kotlin - 如果直接在协程块内调用,为什么`async`不会继承SupervisorJob?
- spring-boot - WAS 8.5.5.12 的 springboot 应用程序部署问题
- ios - 如何更新firebase中的用户信息?
- c# - 哈希集
在不使用 LINQ 的情况下使用自定义 IComparer 进行排序