我目前正在编写Terraform脚本,以提供ElastiCache Redis集群。我有以下几点担心。在脚本中,我使用快照名称从ElastiCache单个Redis实例恢复数据库。
但是,当我试图从cluster_mode脚本中向其添加更多的碎片( tf )时,需要再次输入一个正确的快照名称(我有自动备份,这就是快照名称经常更改的原因)。如果不匹配,Terraform建议我销毁现有的集群并再次创建一个新的集群。
resource "aws_elasticache_replication_group" "default" {
replication_group_id = "${var.cluster_id}"
replication_group_description = "Redis cluster for Hashicorp ElastiCache example"
node_type = "cache.m4.large"
port = 6379
parameter_group_name = "default.redis3.2.cluster.on"
snapshot_name = "${var.snapshot_name}"
snapshot_retention_limit = 5
snapshot_window = "00:00-05:00"
subnet_group_name = "${aws_elasticache_subnet_group.default.name}"
automatic_failover_enabled = true
cluster_mode {
replicas_per_node_group = 1
num_node_groups = "${var.node_groups}"
}
} 是否有可能以某种方式将集群创建和数据恢复的配置分为两种配置?
或者,跳过问我一个快照名称是否集群已经准备好了?
我可以选这个字段吗?
目前的行动:
谢谢。
发布于 2019-03-14 04:55:42
因此,我用lifecycle ignore_changes元参数解决了这个问题:
lifecycle {
ignore_changes = [
"node_type",
"snapshot_name",
]
}我将snapshot_name资源属性添加到ignore_changes元参数中,并将其保存在那里,直到需要从备份重新创建集群。在这种情况下,我把它排除在列表之外。
https://serverfault.com/questions/956745
复制相似问题