Skip to content

Normalize JSON when doing comparison for mappings, etc. #362

@subsetpark

Description

@subsetpark

Here's a TF plan that I'm currently getting:

  # module.es-prod-22-search.elasticsearch_index.block[1] must be replaced
-/+ resource "elasticsearch_index" "block" {
     ...
      ~ id                                     = "block-deleted-1" -> (known after apply)
      ~ mappings                               = jsonencode( # whitespace changes force replacement
            {
                _routing   = {
                    required = true
                }
...

That is, it suggests that even though the json value of my index mappings hasn't changed at all, the whitespace that I input is not identical to the whitespace in the ES cluster.

I've done some googling about this, and most reports seem to say something like "it's the responsibility of the provider" to ignore whitespace when comparing to the value on the state.

Some citations:

Is this somethat that can be fixed in this provider? Because of this spurious change, we're not able to make any live changes to our cluster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions