Search code examples
amazon-web-servicesterraformopensearchamazon-opensearch

Update AWS opensearch "Max clause count" attribute via terraform


I'm trying to update Opensearch "Max clause count" via terraform, but I didn't find a terraform resource that contains this attribute.

Opensearch Cluster settings

That's the code of my resource:

resource "aws_elasticsearch_domain" "discovery" {
  domain_name           = var.region == "us-east-1" ? "${var.namespace}-${var.service}-${var.env}-domain" : "${var.service}-${var.env}-${var.region_prefix}-domain"
  elasticsearch_version = "OpenSearch_1.3"

  cluster_config {
    instance_type            = "c6g.2xlarge.elasticsearch"
    instance_count           = 6
    dedicated_master_count   = 3
    dedicated_master_enabled = true
    dedicated_master_type    = "m6g.xlarge.elasticsearch"
    zone_awareness_enabled   = true
    zone_awareness_config {
      availability_zone_count = 2
    }
  }

Can someone assist?


Solution

  • You have to set them using advanced_options as explained in the AWS docs.

    Also, if you have an existing domain with those options, you can use AWS CLI's describe-domain to check how exactly AdvancedOptions are defined.