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)) 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 diff --git a/internal/clients/config/elasticsearch.go b/internal/clients/config/elasticsearch.go index 958fb6c8b..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,6 +44,13 @@ func newElasticsearchConfigFromSDK(d *schema.ResourceData, base baseConfig, key config.config.Addresses = addrs } + 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))) + } + } + if bearer_token, ok := esConfig["bearer_token"].(string); ok && bearer_token != "" { config.bearerToken = bearer_token } @@ -145,6 +153,12 @@ func newElasticsearchConfigFromFramework(ctx context.Context, cfg ProviderConfig config.config.Addresses = endpoints } + 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() != "" { 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..6006bcfa5 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.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 1cf4202e4..bd911a289 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.MapAttribute{ + 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.TypeMap, + Optional: true, + Sensitive: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "insecure": { Description: "Disable TLS certificate validation", Type: schema.TypeBool,