opensearch-project / terraform-provider-opensearch

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

[BUG] 2.0 beta cannot import index template - not found - still happening in 2.2.1 #67

Open xsnrg opened 1 year ago

xsnrg commented 1 year ago

What is the bug?

terraform cannot import index template - not found

How can one reproduce the bug?

Create an index template in some way. In this case I create an index template with an older provider. Switch to the new provider and try to import, and it is not able to find the index.

What is the expected behavior?

The index template should import from the existing configuration by name

What is your host/environment?

MacOS for the terraform client, Server cluster is AWS Opensearch 2.7

Do you have any screenshots?

GET _cat/templates - shows the templates GET _index_template/* - does not show templates

Do you have any additional context?

The cluster is running in compatibility mode, and the index template API may have changed between the provider that created the template and the one trying to import it. The console shows the index template though, so the new provider should be able to find it and import it.

zelinh commented 1 year ago

[Triage] @prudhvigodithi @phillbaker Could you help look into this issue as well? Thanks!

prudhvigodithi commented 1 year ago

Related Similar issue https://github.com/opensearch-project/terraform-provider-opensearch/issues/71 Closing this, @xsnrg please re-open if required. Adding @phillbaker @david-alpert-nl @bbarani @peterzhuamazon

xsnrg commented 6 months ago

This is still happening, and I do not seem to have the ability to re-open.

xsnrg commented 6 months ago

terraform import module.es-indexes.opensearch_index_template.app app Running (inside redacted): module.es-indexes.data.aws_opensearch_domain.domain: Reading... module.es-indexes.data.aws_opensearch_domain.domain: Read complete after 1s [redacted] module.es-indexes.opensearch_index_template.app: Importing from ID "app"... module.es-indexes.opensearch_index_template.app: Import prepared! Prepared opensearch_index_template for import module.es-indexes.opensearch_index_template.app: Refreshing state... [id=app] ╷ │ Error: Cannot import non-existent remote object │ │ While attempting to import an existing object to "module.es-indexes.opensearch_index_template.app", the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" │ to create a new remote object for this resource. ╵

$ curl -H GET https://[URL]/_template/app {"app":{"order":10,"index_patterns":["app-*"],"settings":{"index":{"refresh_interval":"5s"}},"mappings":{"dynamic":"false","properties":{"exception":{"type":"text","fields":{"keyword":{"ignore_ab......

xsnrg commented 6 months ago

@prudhvigodithi - Are you able to re-open?

prudhvigodithi commented 3 months ago

Sure @xsnrg, Adding @getsaurabh02

dblock commented 3 months ago

[Catch All Triage - 1, 2]