gpt4 book ai didi

amazon-web-services - 无法使用Terraform为ElasticSearch添加2个子网

转载 作者:行者123 更新时间:2023-12-02 22:47:52 27 4
gpt4 key购买 nike

我正在尝试使用Terraform构建ElasticSearch集群,但无法分配超过1个子网!这真的很奇怪,因为在文档中有这样的内容:

https://www.terraform.io/docs/providers/aws/r/elasticsearch_domain.html#subnet_ids

subnet_ids - (Required) List of VPC Subnet IDs for the Elasticsearch domain endpoints to be created in.



但是当我尝试这样做时,我得到了这个错误:

Error: ValidationException: You must specify exactly one subnet



这是我的代码:
resource "aws_elasticsearch_domain" "es" {
domain_name = "${var.es_domain}-${var.environment}"
elasticsearch_version = "${var.es_version}"

cluster_config {
instance_type = "${var.es_instance_type}"
instance_count = "${var.es_instance_count}"
}
vpc_options {

subnet_ids = ["${data.aws_subnet.private_1.id}", "${data.aws_subnet.private_2.id}"]

security_group_ids = ["${aws_security_group.es.id}"]
}

snapshot_options { automated_snapshot_start_hour = "${var.es_automated_spanshot_start_hour}" }

ebs_options {
ebs_enabled = true
volume_type = "standard"
volume_size = "20"
}


access_policies = <<CONFIG
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "es:*",
"Principal": "*",
"Effect": "Allow",
"Resource": "arn:aws:es:${var.aws_region}:${data.aws_caller_identity.current.account_id}:domain/${var.es_domain}/*"
}
]
}
CONFIG


}

我正在使用terraform v0.12.2

谢谢你的帮助。

最佳答案

您在使用多个AZ Elasticsearch集群时需要的zone_awareness_enabled中缺少 cluster_config parameter

关于amazon-web-services - 无法使用Terraform为ElasticSearch添加2个子网,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56594965/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com