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

When dedicated_master_enabled is false, the dedicated_master_count and type should be ignored #143

Closed franciscoandrade82 closed 1 year ago

franciscoandrade82 commented 1 year ago

Describe the Bug

When setting the dedicated_master_enabled = false but having the dedicated_master_type and/or dedicated_master_count setted, a validation exception is raised.

ValidationException: DedicatedMasterEnabled must be set to True to specify the DedicatedMasterCount and DedicatedMasterType options.

I'm reusing the same terraform to deploy to non-prod and prod environments, and I was expecting to be able to reuse the same code. Similar to what is implemented for warm nodes.

Expected Behavior

I'm expecting the provider to being able to abstract this. I think that we should have an implementation similar to the one in the warm nodes.

warm_count = var.warm_enabled ? var.warm_count : null warm_type = var.warm_enabled ? var.warm_type : null

Steps to Reproduce

Set the dedicated_master_enabled to false and set values for type and count

franciscoandrade82 commented 1 year ago

I think that we can easily solve this by changing the main.tf file to include the following:

dedicated_master_enabled = var.dedicated_master_enabled
dedicated_master_count   = var.dedicated_master_enabled ? var.dedicated_master_count : null
dedicated_master_type    = var.dedicated_master_enabled ? var.dedicated_master_type : null