From 5c9051854bcd2f18c40c8e4deaa666a21e67e302 Mon Sep 17 00:00:00 2001 From: Daniel Kurzmann Date: Wed, 12 Mar 2025 16:18:17 +0100 Subject: [PATCH 1/5] chore: add headers to the requests --- internal/clients/config/elasticsearch.go | 18 ++++++++++++++++++ internal/clients/config/provider.go | 1 + internal/schema/connection.go | 15 +++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/internal/clients/config/elasticsearch.go b/internal/clients/config/elasticsearch.go index 958fb6c8b..ce0d25041 100644 --- a/internal/clients/config/elasticsearch.go +++ b/internal/clients/config/elasticsearch.go @@ -145,6 +145,24 @@ func newElasticsearchConfigFromFramework(ctx context.Context, cfg ProviderConfig config.config.Addresses = endpoints } + var headers []string + headerDiags := esConfig.Headers.ElementsAs(ctx, &headers, true) + if headerDiags.HasError() { + return nil, diags + } + + if len(headers) > 0 { + for _, header := range headers { + headerParts := strings.Split(header, ":") + if len(headerParts) != 2 { + diags.Append(fwdiags.NewErrorDiagnostic("Invalid header format", "Headers must be in the format 'key:value'")) + return nil, diags + } + // trim the strings to remove any leading/trailing whitespace + config.config.Header.Add(strings.TrimSpace(headerParts[0]), strings.TrimSpace(headerParts[1])) + } + } + if esConfig.BearerToken.ValueString() != "" { config.bearerToken = esConfig.BearerToken.ValueString() if esConfig.ESClientAuthentication.ValueString() != "" { diff --git a/internal/clients/config/provider.go b/internal/clients/config/provider.go index f57dcff8d..f6574da90 100644 --- a/internal/clients/config/provider.go +++ b/internal/clients/config/provider.go @@ -15,6 +15,7 @@ type ElasticsearchConnection struct { BearerToken types.String `tfsdk:"bearer_token"` ESClientAuthentication types.String `tfsdk:"es_client_authentication"` Endpoints types.List `tfsdk:"endpoints"` + Headers types.List `tfsdk:"headers"` Insecure types.Bool `tfsdk:"insecure"` CAFile types.String `tfsdk:"ca_file"` CAData types.String `tfsdk:"ca_data"` diff --git a/internal/schema/connection.go b/internal/schema/connection.go index 1cf4202e4..838dd4f99 100644 --- a/internal/schema/connection.go +++ b/internal/schema/connection.go @@ -72,6 +72,12 @@ func GetEsFWConnectionBlock(keyName string, isProviderConfiguration bool) fwsche Sensitive: true, ElementType: types.StringType, }, + "headers": fwschema.ListAttribute{ + MarkdownDescription: "A list of headers to be sent with each request to Elasticsearch.", + Optional: true, + Sensitive: true, + ElementType: types.StringType, + }, "insecure": fwschema.BoolAttribute{ MarkdownDescription: "Disable TLS certificate validation", Optional: true, @@ -311,6 +317,15 @@ func GetEsConnectionSchema(keyName string, isProviderConfiguration bool) *schema Type: schema.TypeString, }, }, + "headers": { + Description: "A list of headers to be sent with each request to Elasticsearch.", + Type: schema.TypeList, + Optional: true, + Sensitive: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "insecure": { Description: "Disable TLS certificate validation", Type: schema.TypeBool, From d365c572dd613043206aa1d0119d0fd98564239a Mon Sep 17 00:00:00 2001 From: Daniel Kurzmann Date: Fri, 14 Mar 2025 11:58:16 +0100 Subject: [PATCH 2/5] chore: add headers to the legacy provider part --- internal/clients/config/elasticsearch.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/clients/config/elasticsearch.go b/internal/clients/config/elasticsearch.go index ce0d25041..ed06fec31 100644 --- a/internal/clients/config/elasticsearch.go +++ b/internal/clients/config/elasticsearch.go @@ -43,6 +43,18 @@ func newElasticsearchConfigFromSDK(d *schema.ResourceData, base baseConfig, key config.config.Addresses = addrs } + if headers, ok := esConfig["headers"]; ok && len(headers.([]interface{})) > 0 { + var header_values []string + for _, e := range headers.([]interface{}) { + header_values = append(header_values, e.(string)) + } + + for _, header := range header_values { + headerParts := strings.Split(header, ":") + config.config.Header.Add(strings.TrimSpace(headerParts[0]), strings.TrimSpace(headerParts[1])) + } + } + if bearer_token, ok := esConfig["bearer_token"].(string); ok && bearer_token != "" { config.bearerToken = bearer_token } From 5b060d31dd531f885322a260da29efe00497482f Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Wed, 19 Mar 2025 15:05:42 +1100 Subject: [PATCH 3/5] Make headers a map --- internal/clients/config/elasticsearch.go | 34 +++++++----------------- internal/clients/config/provider.go | 2 +- internal/schema/connection.go | 4 +-- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/internal/clients/config/elasticsearch.go b/internal/clients/config/elasticsearch.go index ed06fec31..80f0edb6e 100644 --- a/internal/clients/config/elasticsearch.go +++ b/internal/clients/config/elasticsearch.go @@ -11,6 +11,7 @@ import ( "github.com/elastic/go-elasticsearch/v8" fwdiags "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" sdkdiags "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -43,15 +44,10 @@ func newElasticsearchConfigFromSDK(d *schema.ResourceData, base baseConfig, key config.config.Addresses = addrs } - if headers, ok := esConfig["headers"]; ok && len(headers.([]interface{})) > 0 { - var header_values []string - for _, e := range headers.([]interface{}) { - header_values = append(header_values, e.(string)) - } - - for _, header := range header_values { - headerParts := strings.Split(header, ":") - config.config.Header.Add(strings.TrimSpace(headerParts[0]), strings.TrimSpace(headerParts[1])) + if headers, ok := esConfig["headers"]; ok && len(headers.(map[string]interface{})) > 0 { + headersMap := headers.(map[string]interface{}) + for header, value := range headersMap { + config.config.Header.Add(strings.TrimSpace(header), strings.TrimSpace(value.(string))) } } @@ -157,22 +153,10 @@ func newElasticsearchConfigFromFramework(ctx context.Context, cfg ProviderConfig config.config.Addresses = endpoints } - var headers []string - headerDiags := esConfig.Headers.ElementsAs(ctx, &headers, true) - if headerDiags.HasError() { - return nil, diags - } - - if len(headers) > 0 { - for _, header := range headers { - headerParts := strings.Split(header, ":") - if len(headerParts) != 2 { - diags.Append(fwdiags.NewErrorDiagnostic("Invalid header format", "Headers must be in the format 'key:value'")) - return nil, diags - } - // trim the strings to remove any leading/trailing whitespace - config.config.Header.Add(strings.TrimSpace(headerParts[0]), strings.TrimSpace(headerParts[1])) - } + for header, value := range esConfig.Headers.Elements() { + strValue := value.(basetypes.StringValue) + // trim the strings to remove any leading/trailing whitespace + config.config.Header.Add(strings.TrimSpace(header), strings.TrimSpace(strValue.ValueString())) } if esConfig.BearerToken.ValueString() != "" { diff --git a/internal/clients/config/provider.go b/internal/clients/config/provider.go index f6574da90..6006bcfa5 100644 --- a/internal/clients/config/provider.go +++ b/internal/clients/config/provider.go @@ -15,7 +15,7 @@ type ElasticsearchConnection struct { BearerToken types.String `tfsdk:"bearer_token"` ESClientAuthentication types.String `tfsdk:"es_client_authentication"` Endpoints types.List `tfsdk:"endpoints"` - Headers types.List `tfsdk:"headers"` + Headers types.Map `tfsdk:"headers"` Insecure types.Bool `tfsdk:"insecure"` CAFile types.String `tfsdk:"ca_file"` CAData types.String `tfsdk:"ca_data"` diff --git a/internal/schema/connection.go b/internal/schema/connection.go index 838dd4f99..bd911a289 100644 --- a/internal/schema/connection.go +++ b/internal/schema/connection.go @@ -72,7 +72,7 @@ func GetEsFWConnectionBlock(keyName string, isProviderConfiguration bool) fwsche Sensitive: true, ElementType: types.StringType, }, - "headers": fwschema.ListAttribute{ + "headers": fwschema.MapAttribute{ MarkdownDescription: "A list of headers to be sent with each request to Elasticsearch.", Optional: true, Sensitive: true, @@ -319,7 +319,7 @@ func GetEsConnectionSchema(keyName string, isProviderConfiguration bool) *schema }, "headers": { Description: "A list of headers to be sent with each request to Elasticsearch.", - Type: schema.TypeList, + Type: schema.TypeMap, Optional: true, Sensitive: true, Elem: &schema.Schema{ From e2c4f91855fb3ef8e232a6d212d9cbf0de92c6e7 Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Wed, 19 Mar 2025 15:06:24 +1100 Subject: [PATCH 4/5] make docs-generate --- docs/data-sources/elasticsearch_index_template.md | 1 + docs/data-sources/elasticsearch_security_role.md | 1 + docs/data-sources/elasticsearch_security_role_mapping.md | 1 + docs/data-sources/elasticsearch_security_user.md | 1 + docs/data-sources/elasticsearch_snapshot_repository.md | 1 + docs/index.md | 1 + docs/resources/elasticsearch_cluster_settings.md | 1 + docs/resources/elasticsearch_component_template.md | 1 + docs/resources/elasticsearch_data_stream.md | 1 + docs/resources/elasticsearch_data_stream_lifecycle.md | 1 + docs/resources/elasticsearch_enrich_policy.md | 1 + docs/resources/elasticsearch_index.md | 1 + docs/resources/elasticsearch_index_lifecycle.md | 1 + docs/resources/elasticsearch_index_template.md | 1 + docs/resources/elasticsearch_ingest_pipeline.md | 1 + docs/resources/elasticsearch_logstash_pipeline.md | 1 + docs/resources/elasticsearch_script.md | 1 + docs/resources/elasticsearch_security_api_key.md | 1 + docs/resources/elasticsearch_security_role.md | 1 + docs/resources/elasticsearch_security_role_mapping.md | 1 + docs/resources/elasticsearch_security_system_user.md | 1 + docs/resources/elasticsearch_security_user.md | 1 + docs/resources/elasticsearch_snapshot_lifecycle.md | 1 + docs/resources/elasticsearch_snapshot_repository.md | 1 + 24 files changed, 24 insertions(+) diff --git a/docs/data-sources/elasticsearch_index_template.md b/docs/data-sources/elasticsearch_index_template.md index c80a69b48..c1363c3cd 100644 --- a/docs/data-sources/elasticsearch_index_template.md +++ b/docs/data-sources/elasticsearch_index_template.md @@ -61,6 +61,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/data-sources/elasticsearch_security_role.md b/docs/data-sources/elasticsearch_security_role.md index 0d432334f..f41c364c0 100644 --- a/docs/data-sources/elasticsearch_security_role.md +++ b/docs/data-sources/elasticsearch_security_role.md @@ -62,6 +62,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/data-sources/elasticsearch_security_role_mapping.md b/docs/data-sources/elasticsearch_security_role_mapping.md index 2426740ef..ae93d8aaf 100644 --- a/docs/data-sources/elasticsearch_security_role_mapping.md +++ b/docs/data-sources/elasticsearch_security_role_mapping.md @@ -59,6 +59,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/data-sources/elasticsearch_security_user.md b/docs/data-sources/elasticsearch_security_user.md index 31f05164b..6fc2c049c 100644 --- a/docs/data-sources/elasticsearch_security_user.md +++ b/docs/data-sources/elasticsearch_security_user.md @@ -59,6 +59,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/data-sources/elasticsearch_snapshot_repository.md b/docs/data-sources/elasticsearch_snapshot_repository.md index 1eca5b46a..7004d0ef4 100644 --- a/docs/data-sources/elasticsearch_snapshot_repository.md +++ b/docs/data-sources/elasticsearch_snapshot_repository.md @@ -87,6 +87,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/index.md b/docs/index.md index 061ad84cc..83d4ff982 100644 --- a/docs/index.md +++ b/docs/index.md @@ -159,6 +159,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_cluster_settings.md b/docs/resources/elasticsearch_cluster_settings.md index dfdf3df82..bd591363e 100644 --- a/docs/resources/elasticsearch_cluster_settings.md +++ b/docs/resources/elasticsearch_cluster_settings.md @@ -72,6 +72,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_component_template.md b/docs/resources/elasticsearch_component_template.md index 5d3db33d5..441232654 100644 --- a/docs/resources/elasticsearch_component_template.md +++ b/docs/resources/elasticsearch_component_template.md @@ -97,6 +97,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_data_stream.md b/docs/resources/elasticsearch_data_stream.md index 55aafcac7..6cfb9e88d 100644 --- a/docs/resources/elasticsearch_data_stream.md +++ b/docs/resources/elasticsearch_data_stream.md @@ -103,6 +103,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_data_stream_lifecycle.md b/docs/resources/elasticsearch_data_stream_lifecycle.md index 419ad19a7..1c4d913d8 100644 --- a/docs/resources/elasticsearch_data_stream_lifecycle.md +++ b/docs/resources/elasticsearch_data_stream_lifecycle.md @@ -94,6 +94,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_enrich_policy.md b/docs/resources/elasticsearch_enrich_policy.md index 934a31e24..0fb926ffa 100644 --- a/docs/resources/elasticsearch_enrich_policy.md +++ b/docs/resources/elasticsearch_enrich_policy.md @@ -79,6 +79,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_index.md b/docs/resources/elasticsearch_index.md index e3312f73d..da59dd302 100644 --- a/docs/resources/elasticsearch_index.md +++ b/docs/resources/elasticsearch_index.md @@ -165,6 +165,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_index_lifecycle.md b/docs/resources/elasticsearch_index_lifecycle.md index 43ab3c0bc..99c241035 100644 --- a/docs/resources/elasticsearch_index_lifecycle.md +++ b/docs/resources/elasticsearch_index_lifecycle.md @@ -206,6 +206,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_index_template.md b/docs/resources/elasticsearch_index_template.md index 696fd5fb6..17cc732de 100644 --- a/docs/resources/elasticsearch_index_template.md +++ b/docs/resources/elasticsearch_index_template.md @@ -89,6 +89,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_ingest_pipeline.md b/docs/resources/elasticsearch_ingest_pipeline.md index 27fd4b0cf..53f4c94dd 100644 --- a/docs/resources/elasticsearch_ingest_pipeline.md +++ b/docs/resources/elasticsearch_ingest_pipeline.md @@ -102,6 +102,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_logstash_pipeline.md b/docs/resources/elasticsearch_logstash_pipeline.md index 3baac1418..bf7f49394 100644 --- a/docs/resources/elasticsearch_logstash_pipeline.md +++ b/docs/resources/elasticsearch_logstash_pipeline.md @@ -101,6 +101,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_script.md b/docs/resources/elasticsearch_script.md index 8b293a3a1..f551360af 100644 --- a/docs/resources/elasticsearch_script.md +++ b/docs/resources/elasticsearch_script.md @@ -74,6 +74,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_security_api_key.md b/docs/resources/elasticsearch_security_api_key.md index 697560ec6..b014d4bd7 100644 --- a/docs/resources/elasticsearch_security_api_key.md +++ b/docs/resources/elasticsearch_security_api_key.md @@ -113,6 +113,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_security_role.md b/docs/resources/elasticsearch_security_role.md index 699bf4d2a..803a08719 100644 --- a/docs/resources/elasticsearch_security_role.md +++ b/docs/resources/elasticsearch_security_role.md @@ -91,6 +91,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_security_role_mapping.md b/docs/resources/elasticsearch_security_role_mapping.md index 6be2855d0..c3248fe24 100644 --- a/docs/resources/elasticsearch_security_role_mapping.md +++ b/docs/resources/elasticsearch_security_role_mapping.md @@ -69,6 +69,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_security_system_user.md b/docs/resources/elasticsearch_security_system_user.md index ffaa39946..2d00da36d 100644 --- a/docs/resources/elasticsearch_security_system_user.md +++ b/docs/resources/elasticsearch_security_system_user.md @@ -63,6 +63,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_security_user.md b/docs/resources/elasticsearch_security_user.md index 27c0907e1..c00f629bb 100644 --- a/docs/resources/elasticsearch_security_user.md +++ b/docs/resources/elasticsearch_security_user.md @@ -88,6 +88,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_snapshot_lifecycle.md b/docs/resources/elasticsearch_snapshot_lifecycle.md index f8b6b10ae..f4c893c8e 100644 --- a/docs/resources/elasticsearch_snapshot_lifecycle.md +++ b/docs/resources/elasticsearch_snapshot_lifecycle.md @@ -87,6 +87,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth diff --git a/docs/resources/elasticsearch_snapshot_repository.md b/docs/resources/elasticsearch_snapshot_repository.md index e8e427efe..4cdab4e26 100644 --- a/docs/resources/elasticsearch_snapshot_repository.md +++ b/docs/resources/elasticsearch_snapshot_repository.md @@ -90,6 +90,7 @@ Optional: - `cert_file` (String) Path to a file containing the PEM encoded certificate for client auth - `endpoints` (List of String, Sensitive) A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number. - `es_client_authentication` (String, Sensitive) ES Client Authentication field to be used with the JWT token +- `headers` (Map of String, Sensitive) A list of headers to be sent with each request to Elasticsearch. - `insecure` (Boolean) Disable TLS certificate validation - `key_data` (String, Sensitive) PEM encoded private key for client auth - `key_file` (String) Path to a file containing the PEM encoded private key for client auth From 1e1d851140b0dc3d8db13bc32cdafe99cdb4df0f Mon Sep 17 00:00:00 2001 From: Daniel Kurzmann Date: Mon, 28 Apr 2025 16:07:07 +0200 Subject: [PATCH 5/5] chore: add PR information --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bc247eab..08d44ca49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] +- Add `headers` for the provider connection ([#1057](https://github.com/elastic/terraform-provider-elasticstack/pull/1057)) + ## [0.11.15] - 2025-04-23 - Add `global_data_tags` to fleet agent policies. ([#1044](https://github.com/elastic/terraform-provider-elasticstack/pull/1044))