elastic / terraform-provider-elasticstack

Terraform provider for Elastic Stack
https://registry.terraform.io/providers/elastic/elasticstack/latest/docs
Apache License 2.0
167 stars 92 forks source link

[Feature] Support "Allow auto create" in the index template configuration #616

Open andrewnazarov opened 5 months ago

andrewnazarov commented 5 months ago

Is your feature request related to a problem? Please describe. We create index templates with TF and most of them also create data streams. We need "Allow auto create" option to be configurable

Describe the resource you would like to have implemented. This could be supported in elasticstack_elasticsearch_index_template

Describe the solution you'd like Allow auto create set to "true" (see the screenshot)

Screenshot 2024-04-26 at 15 21 16

Describe alternatives you've considered No

JNickson commented 3 months ago

The reason they haven't made this a feature on this resource is because this is handled at the cluster level.

See below for documentation: Elastic Documentation

PUT _cluster/settings
{
  "persistent": {
    "action.auto_create_index": "my-index-000001,index10,-index1*,+ind*" 
  }
}

The correct resource would be: Terraform Cluster-Settings Resource

resource "elasticstack_elasticsearch_cluster_settings" "my_cluster_settings-dev" {
  persistent {
    setting {
        name = "action.auto_create_index"
        value = "index / true / false"
    } 

Although FYI the only testing done is for indices.* & xpack it looks like as shown here

Hope this helps.