Open arichtman-srt opened 1 year ago
[Triage] Adding @prudhvigodithi to take a look on this. Thanks.
Hey @arichtman-srt can you please test with the latest release? https://registry.terraform.io/providers/opensearch-project/opensearch/2.0.0-beta.1 Thank you
Tested today with 2.1.0 and no working with this example:
Example from doc opensearch_index_template resource are not working. I had to update the json.
# Create an index template
resource "opensearch_index_template" "logs_1" {
name = "logs_1"
body = <<EOF
{
"index_patterns": [ "logs*" ],
"template": {
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "0",
"refresh_interval": "5s"
}
}
}
}
EOF
}
# Create a simple index
resource "opensearch_index" "logs-01" {
name = "logs-01"
}
as output
Terraform will perform the following actions:
# opensearch_index.logs-01 will be updated in-place
~ resource "opensearch_index" "logs-01" {
id = "logs-01"
name = "logs-01"
- number_of_replicas = "0" -> null
- refresh_interval = "5s" -> null
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
opensearch_index.logs-01: Modifying... [id=logs-01]
╷
│ Error: elastic: Error 400 (Bad Request): failed to parse setting [index.refresh_interval] with value [] as a time value: unit is missing or unrecognized [type=illegal_argument_exception]
│
│ with opensearch_index.logs-01,
│ on main.tf line 50, in resource "opensearch_index" "logs-01":
│ 50: resource "opensearch_index" "logs-01" {
As a workaround
# Create a simple index
resource "opensearch_index" "logs-01" {
name = "logs-01"
lifecycle {
ignore_changes = [
number_of_replicas,
refresh_interval
]
}
}
What is the bug?
Terraform tries to set the number of replicas back to null, which will never work.
How can one reproduce the bug?
opensearch_index
type and set the only required property,name
number_of_replicas
number_of_replicas
tonull
What is the expected behavior?
Either: A) It's possible to set replica count to nothing, in which case Terraform does so B) Number of replicas property should be mandatory
What is your host/environment?
Do you have any screenshots?
Do you have any additional context?
Technically it's correct that replica count isn't required to create an index. But I'm no software philosopher.