Skip to content

[Bug] Error when building elasticstack_elasticsearch_index_lifecycle resource (2) #80

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

Closed
RyanHealey1307 opened this issue Feb 24, 2022 · 4 comments · Fixed by #81
Closed
Assignees
Labels
bug Something isn't working Elasticsearch Elasticsearch related APIs

Comments

@RyanHealey1307
Copy link

Hello, we're using the elasticstack provider in Terraform to build of some of our Elastic resources - when trying to build an ILM policy to our cluster via the elasticstack_elasticsearch_index_lifecycle resource the resource fails to apply for the allocate meta-argument (my colleague raised a similar request on 0.2.0 which is 'closed' now - but still getting an error.).

We're tried this on 0.3.0 and 0.3.1 -

Here is our Terraform code:

resource "elasticstack_elasticsearch_index_lifecycle" "index_lifecycle_logs_default" {
name = "logs-default"

hot {
min_age = "0ms"
set_priority {
priority = 100
}
rollover {
max_primary_shard_size = "10gb"
max_age = "14d"
}
}

warm {
min_age = "0ms"
set_priority {
priority = 60
}
readonly {}
allocate {
number_of_replicas = 0
}
}

delete {
min_age = "31d"
delete {
delete_searchable_snapshot = true
}
wait_for_snapshot {
policy = "my-s3-policy"
}
}
}

Error message:

Error: Unable to create or update the ILM policy

with module.elastic_tribe_config.elasticstack_elasticsearch_index_lifecycle.index_lifecycle_logs_default,
on ../../lifecycle.tf line 1, in resource "elasticstack_elasticsearch_index_lifecycle" "index_lifecycle_logs_default":
1: resource "elasticstack_elasticsearch_index_lifecycle" "index_lifecycle_logs_default" {

Failed with:
{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"Failed
to build [allocate] after last required field
arrived"}],"type":"x_content_parse_exception","reason":"[1:329]
[put_lifecycle_request] failed to parse field
[policy]","caused_by":{"type":"x_content_parse_exception","reason":"[1:329]
[lifecycle_policy] failed to parse field
[phases]","caused_by":{"type":"x_content_parse_exception","reason":"[1:329]
[phases] failed to parse field
[warm]","caused_by":{"type":"x_content_parse_exception","reason":"[1:329]
[phase] failed to parse field
[actions]","caused_by":{"type":"x_content_parse_exception","reason":"[1:329]
[actions] failed to parse field
[allocate]","caused_by":{"type":"x_content_parse_exception","reason":"Failed
to build [allocate] after last required field
arrived","caused_by":{"type":"illegal_argument_exception","reason":"At least
one of include, exclude or requiremust contain attributes for action
allocate"}}}}}}},"status":400}

Expected behaviour
We'd expect this to plan and apply successfully and the lifecycle to be functional in Elastic - as stated in the docs "You must specify the number of replicas OR at least one include, exclude, or require option. An empty allocate action is invalid", so I would expect just specifying the 'number_of_replicas' as '0' would be appropriate.

@RyanHealey1307 RyanHealey1307 added the bug Something isn't working label Feb 24, 2022
@olksdr olksdr self-assigned this Feb 24, 2022
@olksdr olksdr added the Elasticsearch Elasticsearch related APIs label Feb 24, 2022
@olksdr
Copy link
Contributor

olksdr commented Feb 24, 2022

Hey @RyanHealey1307 , thanks for the report. Good catch!
This is another bug which went unnoticed and I've already prepared the fix in #81

@RyanHealey1307
Copy link
Author

Thank you very much @olksdr much appreciated!

@olksdr
Copy link
Contributor

olksdr commented Feb 28, 2022

released the new bug fix version v0.3.2, please check it out. I hope the bug is fixed for you

@RyanHealey1307
Copy link
Author

This has solved it, thank you for such a quick release!!

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.

2 participants