phillbaker / terraform-provider-elasticsearch

An elasticsearch provider for terraform
https://registry.terraform.io/providers/phillbaker/elasticsearch
Mozilla Public License 2.0
304 stars 134 forks source link

elasticsearch_opensearch_destination incompatible with OpenSearch 2+ #333

Closed tomwidmer closed 1 year ago

tomwidmer commented 1 year ago

Having upgrade my OpenSearch domains in AWS from 1.3 to 2.3, my elasticsearch_opensearch_destination resources no longer seem to work, since the API is now deprecated and doesn't support creating destinations AFAICT.

Relevant doc: https://opensearch.org/docs/latest/monitoring-plugins/alerting/monitors#questions-about-destinations

My existing destinations (created by terraform) were automatically migrated from being alerting destinations to the new notification plugin's channels (see https://opensearch.org/docs/latest/notifications-plugin/api/#get-channel-configuration).

So terraform no longer detects the destinations, so it tries to recreate them, leading to a 405 error:

17:45:27  │ Error: elastic: Error 405 (Method Not Allowed)
17:45:27  │ 
17:45:27  │   with module.opensearch-config.elasticsearch_opensearch_destination.slack_channel,
17:45:27  │   on modules/opensearch-config/destination.tf line 1, in resource "elasticsearch_opensearch_destination" "slack_channel":
17:45:27  │    1: resource "elasticsearch_opensearch_destination" "slack_channel" {
17:45:27  │ 

Possibly elasticsearch_opensearch_destination can be enhanced to use the new API automatically?

phillbaker commented 1 year ago

Hello, that's correct a new alerts resource will need to be written for opensearch v2 support. Please see https://github.com/phillbaker/terraform-provider-elasticsearch/issues/298 for updates about that issue.