Closed paivin-dn closed 5 days ago
The root cause would be that if raw, ok := d.GetOk(tfFieldKey); ok {
will only be true when the value is not zero value and zero value can't be set at create time.
It seems that's known issue and can be fixed by migrating to new sdk(terraform-provider-framework) since they have IsNull
method to check if not set, or is explicitly set to null.
https://github.com/elastic/terraform-provider-elasticstack/blob/c5e409539eeec2ed46d38eb749ff8d760a9d87d3/internal/utils/utils.go#L148-L163
Workaround would be
number_of_replicas
to 0 after.
resource "elasticstack_elasticsearch_index" "example" {
name = "example"
number_of_shards = 1
number_of_replicas = 1
}
use settings field (it's now deprecated though)
resource "elasticstack_elasticsearch_index" "example" {
name = "example"
number_of_shards = 1
settings {
setting {
name = "number_of_replicas"
value = "0"
}
}
}
The root cause would be that
if raw, ok := d.GetOk(tfFieldKey); ok {
will only be true when the value is not zero value and zero value can't be set at create time. It seems that's known issue and can be fixed by migrating to new sdk(terraform-provider-framework) since they haveIsNull
method to check if not set, or is explicitly set to null.Workaround would be
- create with value > 0 and update
number_of_replicas
to 0 after.resource "elasticstack_elasticsearch_index" "example" { name = "example" number_of_shards = 1 number_of_replicas = 1 }
- use settings field (it's now deprecated though)
resource "elasticstack_elasticsearch_index" "example" { name = "example" number_of_shards = 1 settings { setting { name = "number_of_replicas" value = "0" } } }
Thank you for your reply!
I ran into this recently - not sure why this bug is closed since it isn't fixed?
I'm seeing this problem with the new version of everything
Describe the bug I've tried to create an index with the parameter
number_of_replicas=0
, but in an elasticsearch instance, I've got an index withnumber_of_replicas=1
.To Reproduce Steps to reproduce the behavior:
Expected behavior The created index should have
index.number_of_replicas = 0
instead ofindex.number_of_replicas = 0
Versions (please complete the following information):