-
Notifications
You must be signed in to change notification settings - Fork 121
Description
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.