amazon-web-serviceselasticsearchterraformaws-elasticsearchcloudposse

Terraform, ElasticSearch, module, cloudposse/terraform-aws-elasticsearch


I use the module, https://github.com/cloudposse/terraform-aws-elasticsearch to provision ElasticSearch. I set kibana_hostname_enabled = false, and domain_hostname_enabled = false. Per document, dns_zone_id is not required. But, it asks for dns zone id when I run terraform plan.

terraform plan
var.dns_zone_id
  Route53 DNS Zone ID to add hostname records for Elasticsearch domain and Kibana
  Enter a value:

I prefer not to use Route53. How to avoid dns_zone_id? Below is the code:

module "elasticsearch" {
  source                  = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=tags/0.24.1"

  security_groups                = [data.terraform_remote_state.vpc.outputs.default_security_group_id]
  vpc_id                         = data.terraform_remote_state.vpc.outputs.vpc_id
  zone_awareness_enabled         = var.zone_awareness_enabled
  subnet_ids                     = slice(data.terraform_remote_state.vpc.outputs.private_subnets, 0, 2)
  elasticsearch_version          = var.elasticsearch_version
  instance_type                  = var.instance_type
  instance_count                 = var.instance_count
  encrypt_at_rest_enabled        = var.encrypt_at_rest_enabled
  dedicated_master_enabled       = var.dedicated_master_enabled
  create_iam_service_linked_role = var.create_iam_service_linked_role
  kibana_subdomain_name          = var.kibana_subdomain_name
  ebs_volume_size                = var.ebs_volume_size
  #dns_zone_id                    = var.dns_zone_id
  kibana_hostname_enabled        = false
  domain_hostname_enabled        = false
  iam_role_arns                  = ["*"]
  iam_actions                    = ["es:*"]
  enabled                        = var.enabled
  vpc_enabled                    = var.vpc_enabled
  name                           = var.name
  tags                           = var.tags
  advanced_options = {
    "rest.action.multi.allow_explicit_index" = "true"
  }
}

Solution

  • In your code you have the following:

     #dns_zone_id                    = var.dns_zone_id
    

    So the plan asks for your var.dns_zone_id which you defined, not from the module.