Skip to content

[Feature] Add data_stream_options support to elasticstack_elasticsearch_index_template #2201

@maMykola

Description

@maMykola

Is your feature request related to a problem?

The elasticstack_elasticsearch_index_template resource's template block does not support data_stream_options, which was introduced in Elasticsearch 9.x. This prevents enabling the failure store for data streams via Terraform, requiring out-of-band API calls and creating configuration drift between Terraform state and actual cluster configuration.

Describe the solution you'd like

Add a data_stream_options block inside the template block of elasticstack_elasticsearch_index_template. This should support at minimum the failure_store.enabled boolean.

Desired HCL syntax:

resource "elasticstack_elasticsearch_index_template" "example" {
  name           = "my-index-template"
  index_patterns = ["my-datastream-*"]

  template {
    data_stream_options {
      failure_store {
        enabled = true
      }
    }
  }

  data_stream {}
}

The corresponding Elasticsearch API:

PUT _index_template/my-index-template
{
  "index_patterns": ["my-datastream-*"],
  "data_stream": {},
  "template": {
    "data_stream_options": {
      "failure_store": {
        "enabled": true
      }
    }
  }
}

Describe alternatives you've considered

Using terraform_data with local-exec to GET the index template from Elasticsearch, patch in data_stream_options via jq, and PUT it back. This works but breaks infrastructure-as-code principles, requires curl/jq as dependencies, and creates drift between Terraform state and actual cluster configuration.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions