opensearch-project / terraform-provider-opensearch

https://registry.terraform.io/providers/opensearch-project/opensearch
Apache License 2.0
73 stars 56 forks source link

opensearch_index_template stopped working on opensearch <2.0 eventhough it's documented as working #112

Open arianvp opened 10 months ago

arianvp commented 10 months ago

This introduces a nasty bug! opensearch_index_template is supposed to call _template not _index_template. Now this doesn't behave as documented. The documentation states that opensearch_composable_index_template calls _index_template and you should use opensearch_index_template on opensearch <2.0 but now both resources use the same endpoint.

_Originally posted by @arianvp in https://github.com/opensearch-project/terraform-provider-opensearch/pull/62#discussion_r1370749318_

prudhvigodithi commented 10 months ago

Thanks @arianvp can you please contribute with the fix? Thanks

prudhvigodithi commented 9 months ago

[Untriage] Adding @premkirank @afrodidact

premkirank commented 9 months ago

@prudhvigodithi I would like to work on this

prudhvigodithi commented 9 months ago

Thanks @premkirank

prudhvigodithi commented 9 months ago

Thanks for your PR @premkirank. @arianvp the idea for using Provider 2.x is for OpenSearch version 2.x series, did you try with https://registry.terraform.io/providers/opensearch-project/opensearch/1.0.0 for 1.x series of OpenSearch

More info on compatibility: https://github.com/opensearch-project/terraform-provider-opensearch#compatibility, https://github.com/opensearch-project/terraform-provider-opensearch/tree/1.x#compatibility

sharathganga commented 6 months ago

@prudhvigodithi I'm facing the same issue described above after upgrading to OpenSearch 2.x, I cannot update the opensearch_index_template resources that were created using provider version 1.0.0. When I upgrade to provider version 2.0.0, the plan says that the new resources will be created.

prudhvigodithi commented 6 months ago

Hey @sharathganga may I please know what is the OpenSearch cluster version you are using when used 1.0.0 and 2.x, also can you share the full config file? Adding @rblcoder @bbarani

sharathganga commented 6 months ago

@prudhvigodithi I'm using AWS Opensearch version 2.11. The index templates were created when I was using AWS Opensearch 1.3 and provider 1.0.0. After upgrading the cluster 2.11, I cannot update the index template settings using the same provider version 1.0.0.

Upgraded the provider to the latest version 2.2.0 and the terraform plan shows that the index templates will be recreated using the new _index_template endpoint.

prudhvigodithi commented 6 months ago

Adding @rblcoder

prudhvigodithi commented 6 months ago

I had a call with @rblcoder and the behaviour is expected. The _template is legacy and looks like they replaced by the composable templates. For information about composable templates please check https://opensearch.org/docs/2.11/im-plugin/index-templates/, https://opster.com/guides/opensearch/opensearch-data-architecture/index-templating-in-opensearch-how-to-use-composable-templates/

Also the go client olivere/elastic used routes the requests to _index_templates

@rblcoder @bbarani @peterzhuamazon @gaiksaya please add your thoughts as well.

Tagging index-management owners to please provide some insights on _template and _index_template @bowenlan-amzn @getsaurabh02 @lezzago @amsiglan @AWSHurneyt

Thank you

prudhvigodithi commented 6 months ago

Exact commit in olivere/elastic that depreciated the _template.

rblcoder commented 6 months ago

I have posted a question in the OpenSearch Community https://forum.opensearch.org/t/differences-between-legacy-template-and-index-template/17831