Closed mzamfirmade closed 2 years ago
I accidentally found the issue here after the index was rolled over I updated my terraform to
resource "elasticsearch_index" "index" {
for_each = toset(local.indices)
name = "<${each.value}-{now/d}-000001>"
number_of_shards = 1
number_of_replicas = 1
aliases = jsonencode({"${each.value}" = {}})
default_pipeline = "clean_metrics"
depends_on = [
elasticsearch_index_template.index_template,
elasticsearch_opensearch_ism_policy.ism_policy,
]
}
Now it looks like the index is not re-created at each apply anymore.
Hi,
I am having an issue with the indices I create via terraform, more specific, the indices get recreated each time I apply the terraform and I am not sure that it is intended to work that way.
This is how I am setting them up
This works well on the initial run but doesn't fit its purpose afterwards. Here's the output of the terraform run:
I'm looking for a way to avoid this, I tried adding a condition to only run this once, but that's not how terraform works really and if I try to skip the resource, terraform will see it as missing and remove the index. I also had a read through https://github.com/phillbaker/terraform-provider-elasticsearch/issues/55 since it looks fairly similar, yet doesn't seem to apply in this scenario.
Any help is greatly appreciated.