Elasticsearch domain does not enforce HTTPS

Require HTTPS connections to the search domain.

Description

Set domain_endpoint_options.enforce_https = true on the aws_elasticsearch_domain resource to block plaintext client connections.

Potential impact

Search requests and results sent over HTTP can be read or modified in transit.

Remediation

Move existing clients to HTTPS and verify that they trust the server certificate. After applying the change, check that the same endpoint serves no search results over HTTP.

Examples

Both excerpts keep the same Elasticsearch 7.10 domain. This setting protects the client connection. Configure node-to-node and storage encryption separately.

Before

hcl
resource "aws_elasticsearch_domain" "example" {
  domain_name           = "my-elasticsearch-domain"
  elasticsearch_version = "7.10"

  domain_endpoint_options {
    enforce_https = false
  }
}

After

hcl
resource "aws_elasticsearch_domain" "example" {
  domain_name           = "my-elasticsearch-domain"
  elasticsearch_version = "7.10"

  domain_endpoint_options {
    enforce_https = true
  }
}

References