I'm trying to build an ElasticSearch cluster using Terraform but i'm not able to assign more that 1 subnet! That's really weird cause in the documentation there is this :
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.
But when i try to do that i'm getting this error :
Error: ValidationException: You must specify exactly one subnet
This is my code :
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
}
I'm using terraform v0.12.2
Thanks for your help.