Create an index with 0 replicas using terraform

I am trying to use the latest terraform provider, currently 0.5.0 to create an index with no replicas into an existing Azure managed deployment.

I can successfully create the index, but I always get 1 replica, even though I am setting number_of_replicas to 0.

Does anyone have an idea if I am doing something wrong or the provider is at fault?

The terraform is very simple - like the example below (I've hidden the name and mappings details):

resource "elasticstack_elasticsearch_index" "test_index" {
  name = ...
  mappings = ...

  number_of_shards   = 1
  number_of_replicas = 0

}

Not familiar with terraform, but you should be able to create an index template (in elastic through kibana) where you can specify that any index (ex: test_index*) by default has 1 primary and 0 replicas. My guess is you then wouldn't have to specify that in terraform. Hope that helps.

Hi Andrew - thanks for the suggestion. I guess that would probably work and would be a workaround - but it's a bit hacky. Looks like this is a known bug in the provider - also it seems to have been reported and close although it's not fixed. See here.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.