Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] elasticstack_elasticsearch_index_lifecycle fails when set_priority is 0 #88

Closed
ghost opened this issue Mar 14, 2022 · 1 comment · Fixed by #93
Closed

[Bug] elasticstack_elasticsearch_index_lifecycle fails when set_priority is 0 #88

ghost opened this issue Mar 14, 2022 · 1 comment · Fixed by #93
Assignees
Labels
bug Something isn't working Elasticsearch Elasticsearch related APIs

Comments

@ghost
Copy link

ghost commented Mar 14, 2022

Describe the bug
For elasticstack_elasticsearch_index_lifecycle resource, provider fails when the set_priority action is used and the priority value is set to 0. Values such as 1, 50, 100 do work as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new elasticstack_elasticsearch_index_lifecycle resource
  2. In any lifecycle stage, add {set_priority { priority = 0 }}
  3. Apply

Expected behavior
According to documentation, index priority must be zero or greater. Transmit null in the API call to remove the setting from the ILM policy.

Debug output

input

provider "elasticstack" {
  elasticsearch {
    insecure = true
  }
}

resource "elasticstack_elasticsearch_index_lifecycle" "priority_test" {
    name = "priority_test"

    hot {
        min_age = "0ms"

        set_priority {
          priority = 0
        }

        rollover {
          max_age = "30d"
          max_primary_shard_size = "50gb"
          max_docs = 0
        }
    }

}

error message

│ Error: Unable to create or update the ILM policy
│
│   with elasticstack_elasticsearch_index_lifecycle.priority_test,
│   on ilm_import.tf line 7, in resource "elasticstack_elasticsearch_index_lifecycle" "priority_test":
│    7: resource "elasticstack_elasticsearch_index_lifecycle" "priority_test" {
│
│ Failed with: {"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:133] [actions] failed to parse field [set_priority]"}],"type":"x_content_parse_exception","reason":"[1:133]
│ [put_lifecycle_request] failed to parse field [policy]","caused_by":{"type":"x_content_parse_exception","reason":"[1:133] [lifecycle_policy] failed to parse field
│ [phases]","caused_by":{"type":"x_content_parse_exception","reason":"[1:133] [phases] failed to parse field [hot]","caused_by":{"type":"x_content_parse_exception","reason":"[1:133] [phase] failed to parse
│ field [actions]","caused_by":{"type":"x_content_parse_exception","reason":"[1:133] [actions] failed to parse field [set_priority]","caused_by":{"type":"illegal_argument_exception","reason":"Required
│ [priority]"}}}}}},"status":400}
╵

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • OS: Windows AMD64
  • Terraform Version v1.1.5
  • Provider version v0.3.2
  • Elasticsearch Version v7.16.3

Additional context
Add any other context about the problem here.

@ghost ghost added the bug Something isn't working label Mar 14, 2022
@olksdr olksdr added the Elasticsearch Elasticsearch related APIs label Mar 15, 2022
@olksdr olksdr self-assigned this Mar 15, 2022
@olksdr
Copy link
Contributor

olksdr commented Mar 22, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Elasticsearch Elasticsearch related APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant