Skip to content

[Feature] Don't recreate when there is a diff in dynamic object field #227

@k-yomo

Description

@k-yomo

Is your feature request related to a problem? Please describe.
When we have dynamic field like metadata below, it can be ForceNew because there will be type diff from the latest mapping which have dynamically added inner fields.
It would be great if we could suppress those diffs and not cause recreate.

resource "elasticstack_elasticsearch_index" "test" {
  name     = "test"

  mappings = jsonencode({
    "dynamic" : false,
    "properties" : {
      "name" : {
        "type" : "keyword"
      },
      "metadata" : {
        "type" : "object",
        "dynamic" : true
      }
    },
    "dynamic_templates" : [
      {
        "metadata" : {
          "path_match" : "metadata.*",
          "mapping" : {
            "type" : "keyword",
            "fields" : {
              "text" : {
                "type" : "text",
                "analyzer" : "standard",
                "search_analyzer" : "standard"
              }
            }
          }
        }
      }
  }

Diff

                  ~ metadata                       = {
                      ~ dynamic    = "true" -> true
                      - properties = {
                          ...
                          - someMetadata                       = {
                              - fields  = {
                                  - text = {
                                      - analyzer        = "standard"
                                      - search_analyzer = "standard"
                                      - type            = "text"
                                    }
                                }
                              - type    = "keyword"
                            }
                          },
                          ...

Describe the resource you would like to have implemented.
elasticstack_elasticsearch_index

Describe the solution you'd like
Supress diff in dynamic object field.

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions