我正在尝试使用 Terraform 构建一个 ElasticSearch 集群,但我无法分配超过 1 个子网!这真的很奇怪,因为文档中有这样的:
https://www.terraform.io/docs/providers/aws/r/elasticsearch_domain.html#subnet_ids
subnet_ids -(必需)要在其中创建的 Elasticsearch 域终端节点的 VPC 子网 ID 列表。
但是当我尝试这样做时,我收到了这个错误:
错误:ValidationException:您必须准确指定一个子网
这是我的代码:
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
谢谢你的帮助。