diff --git a/.ci/pipelines/acceptance.groovy b/.ci/pipelines/acceptance.groovy index babc91f77..cf8923e2f 100644 --- a/.ci/pipelines/acceptance.groovy +++ b/.ci/pipelines/acceptance.groovy @@ -11,7 +11,7 @@ pipeline { axes { axis { name 'ES_VERSION' - values '8.0.0', '7.15.1' + values '7.11.2', '7.12.1', '7.13.4', '7.14.2', '7.15.2', '7.16.3', '7.17.4', '8.0.1', '8.1.3', '8.2.2' } } agent { label('linux && immutable && docker') } diff --git a/CHANGELOG.md b/CHANGELOG.md index eec8d1858..6dc63f0a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [Unreleased] ### Fixed - Correctly identify a missing security user ([#101](https://github.com/elastic/terraform-provider-elasticstack/issues/101)) +- Support **7.x** Elasticsearch < **7.15** by removing the default `media_type` attribute in the Append processor ([#118](https://github.com/elastic/terraform-provider-elasticstack/pull/118)) ## [0.3.3] - 2023-03-22 ### Fixed diff --git a/docs/data-sources/elasticsearch_ingest_processor_append.md b/docs/data-sources/elasticsearch_ingest_processor_append.md index c0ff6bbb5..c556abed8 100644 --- a/docs/data-sources/elasticsearch_ingest_processor_append.md +++ b/docs/data-sources/elasticsearch_ingest_processor_append.md @@ -48,7 +48,7 @@ resource "elasticstack_elasticsearch_ingest_pipeline" "my_ingest_pipeline" { - **description** (String) Description of the processor. - **if** (String) Conditionally execute the processor - **ignore_failure** (Boolean) Ignore failures for the processor. -- **media_type** (String) The media type for encoding value. Applies only when value is a template snippet. Must be one of `application/json`, `text/plain`, or `application/x-www-form-urlencoded`. +- **media_type** (String) The media type for encoding value. Applies only when value is a template snippet. Must be one of `application/json`, `text/plain`, or `application/x-www-form-urlencoded`. Supported only from Elasticsearch version **7.15**. - **on_failure** (List of String) Handle failures for the processor. - **tag** (String) Identifier for the processor. diff --git a/internal/elasticsearch/ingest/processor_append_data_source.go b/internal/elasticsearch/ingest/processor_append_data_source.go index 1dad6cad5..0a2128d41 100644 --- a/internal/elasticsearch/ingest/processor_append_data_source.go +++ b/internal/elasticsearch/ingest/processor_append_data_source.go @@ -40,10 +40,9 @@ func DataSourceProcessorAppend() *schema.Resource { Default: true, }, "media_type": { - Description: "The media type for encoding value. Applies only when value is a template snippet. Must be one of `application/json`, `text/plain`, or `application/x-www-form-urlencoded`.", + Description: "The media type for encoding value. Applies only when value is a template snippet. Must be one of `application/json`, `text/plain`, or `application/x-www-form-urlencoded`. Supported only from Elasticsearch version **7.15**.", Type: schema.TypeString, Optional: true, - Default: "application/json", }, "description": { Description: "Description of the processor. ", diff --git a/internal/elasticsearch/ingest/processor_append_data_source_test.go b/internal/elasticsearch/ingest/processor_append_data_source_test.go index 3a84ca80a..52d9a1eca 100644 --- a/internal/elasticsearch/ingest/processor_append_data_source_test.go +++ b/internal/elasticsearch/ingest/processor_append_data_source_test.go @@ -27,8 +27,7 @@ const expectedJsonAppend = `{ "append": { "field": "tags", "value": ["production", "{{{app}}}", "{{{owner}}}"], - "allow_duplicates": true, - "media_type": "application/json", + "allow_duplicates": true, "description": "Append tags to the doc", "ignore_failure": false } diff --git a/internal/models/ingest.go b/internal/models/ingest.go index f11e8616d..0c70aa3b1 100644 --- a/internal/models/ingest.go +++ b/internal/models/ingest.go @@ -28,7 +28,7 @@ type ProcessorAppend struct { Field string `json:"field"` Value []string `json:"value"` AllowDuplicates bool `json:"allow_duplicates"` - MediaType string `json:"media_type"` + MediaType string `json:"media_type,omitempty"` } type ProcessorBytes struct {