diff --git a/CHANGELOG.md b/CHANGELOG.md index c1aabc775..dc615e5be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Add `elasticstack_elasticsearch_security_role_mapping` data source ([#178](https://github.com/elastic/terraform-provider-elasticstack/pull/178)) - Apply `total_shards_per_node` setting in `allocate` action in ILM. Supported from Elasticsearch version **7.16** ([#112](https://github.com/elastic/terraform-provider-elasticstack/issues/112)) - Add `elasticstack_elasticsearch_security_api_key` resource ([#193](https://github.com/elastic/terraform-provider-elasticstack/pull/193)) +- Add `unassigned_node_left_delayed_timeout` to index resource ([#196](https://github.com/elastic/terraform-provider-elasticstack/pull/196)) ### Fixed - Remove unnecessary unsetting id on delete ([#174](https://github.com/elastic/terraform-provider-elasticstack/pull/174)) diff --git a/docs/resources/elasticsearch_index.md b/docs/resources/elasticsearch_index.md index 781fe4759..dac0223f7 100644 --- a/docs/resources/elasticsearch_index.md +++ b/docs/resources/elasticsearch_index.md @@ -122,6 +122,7 @@ If specified, this mapping can include: field names, [field data types](https:// - `shard_check_on_startup` (String) Whether or not shards should be checked for corruption before opening. When corruption is detected, it will prevent the shard from being opened. Accepts `false`, `true`, `checksum`. - `sort_field` (Set of String) The field to sort shards in this index by. - `sort_order` (List of String) The direction to sort shards in. Accepts `asc`, `desc`. +- `unassigned_node_left_delayed_timeout` (String) Time to delay the allocation of replica shards which become unassigned because a node has left, in time units, e.g. `10s` ### Read-Only diff --git a/internal/elasticsearch/index/index.go b/internal/elasticsearch/index/index.go index 76bace528..4c5df66c7 100644 --- a/internal/elasticsearch/index/index.go +++ b/internal/elasticsearch/index/index.go @@ -58,6 +58,7 @@ var ( "gc_deletes": schema.TypeString, "default_pipeline": schema.TypeString, "final_pipeline": schema.TypeString, + "unassigned.node_left.delayed_timeout": schema.TypeString, "search.slowlog.threshold.query.warn": schema.TypeString, "search.slowlog.threshold.query.info": schema.TypeString, "search.slowlog.threshold.query.debug": schema.TypeString, @@ -299,6 +300,12 @@ func ResourceIndex() *schema.Resource { Description: "Final ingest pipeline for the index. Indexing requests will fail if the final pipeline is set and the pipeline does not exist. The final pipeline always runs after the request pipeline (if specified) and the default pipeline (if it exists). The special pipeline name _none indicates no ingest pipeline will run.", Optional: true, }, + "unassigned_node_left_delayed_timeout": { + + Type: schema.TypeString, + Description: "Time to delay the allocation of replica shards which become unassigned because a node has left, in time units, e.g. `10s`", + Optional: true, + }, "search_slowlog_threshold_query_warn": { Type: schema.TypeString, Description: "Set the cutoff for shard level slow search logging of slow searches in the query phase, in time units, e.g. `10s`", diff --git a/internal/elasticsearch/index/index_test.go b/internal/elasticsearch/index/index_test.go index a7a5c504f..b506caf3e 100644 --- a/internal/elasticsearch/index/index_test.go +++ b/internal/elasticsearch/index/index_test.go @@ -82,6 +82,7 @@ func TestAccResourceIndexSettings(t *testing.T) { resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "routing_allocation_enable", "primaries"), resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "routing_rebalance_enable", "primaries"), resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "gc_deletes", "30s"), + resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "unassigned_node_left_delayed_timeout", "5m"), resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "analysis_analyzer", `{"text_en":{"char_filter":"zero_width_spaces","filter":["lowercase","minimal_english_stemmer"],"tokenizer":"standard","type":"custom"}}`), resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "analysis_char_filter", `{"zero_width_spaces":{"mappings":["\\u200C=\u003e\\u0020"],"type":"mapping"}}`), resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "analysis_filter", `{"minimal_english_stemmer":{"language":"minimal_english","type":"stemmer"}}`), @@ -245,6 +246,7 @@ resource "elasticstack_elasticsearch_index" "test_settings" { routing_allocation_enable = "primaries" routing_rebalance_enable = "primaries" gc_deletes = "30s" + unassigned_node_left_delayed_timeout = "5m" analysis_char_filter = jsonencode({ zero_width_spaces = {