cloudposse / terraform-aws-elasticsearch

Terraform module to provision an Elasticsearch cluster with built-in integrations with Kibana and Logstash.
https://cloudposse.com/accelerate
Apache License 2.0
216 stars 231 forks source link

Fix variable availability_zone_count #158

Open Rodce opened 1 year ago

Rodce commented 1 year ago

Describe the Bug

The README says

NOTE: To enable zone awareness to deploy Elasticsearch nodes into two different Availability Zones, you need to set zone_awareness_enabled to true and provide two different subnets in subnet_ids. If you enable zone awareness for your domain, Amazon ES places an endpoint into two subnets. The subnets must be in different Availability Zones in the same region. If you don't enable zone awareness, Amazon ES places an endpoint into only one subnet. You also need to set availability_zone_count to 1.

When I set the value of availability_zone_count to 1 I get an error because in the latest release you didn't correct variables.tf, namely you didn't comment out validation in availability_zone_count

variable "availability_zone_count" {
  type        = number
  default     = 2
  description = "Number of Availability Zones for the domain to use."

  **validation {
    condition     = contains([2, 3], var.availability_zone_count)
    error_message = "The availibility zone count must be 2 or 3."
  }**
}

Expected Behavior

When setting availability_zone_count = 1, I shouldn't get an error

var.availability_zone_count is 1 The availability zone count must be 2 or 3.

Steps to Reproduce

set variable availability_zone_count = 1

Screenshots

No response

Environment

No response

Additional Context

No response

Nuru commented 1 year ago

You also need to set availability_zone_count to 1.

I believe this is incorrect.

Users should be able to set zone_awareness_enabled to false and leave availability_zone_count unset and defaulted to 2, or set to 2 if the configuration of the root module makes leaving it unset too difficult.