opensearch-project / terraform-provider-opensearch

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

[BUG] Error: opensearch version 2.5.0 is older than 6.0.0 and is not supported, flavor: 0. #36

Open komgritz opened 1 year ago

komgritz commented 1 year ago

What is the bug?

Error: opensearch version 2.5.0 is older than 6.0.0 and is not supported, flavor: 0.

How can one reproduce the bug?

1.Provisioning AWS Opensearch version 2.5.0. 2.Create some resource with terraform. Example resource "opensearch_index_template" "log_aws_default" { count = var.environment == "prod" ? 1 : 0 name = "log-aws_default" body = <<EOF { "index_patterns": [ "log-aws-*" ], "order": 0, "settings": { "index": { "number_of_shards": "1", "number_of_replicas": "1" } }, "mappings": { "_source": { "enabled": true } }, "aliases" : { "log-aws": {} } } EOF }

  1. Run terraform apply.

What is the expected behavior?

Terraform apply all resources successfully.

What is your host/environment?

AWS Opensearch version 2.5.0.

Do you have any screenshots?

│ Error: opensearch version 2.5.0 is older than 6.0.0 and is not supported, flavor: 0. │ │ with opensearch_ism_policy.log_aws_default[0], │ on index-opensearch.tf line 2, in resource "opensearch_ism_policy" "log_aws_default": │ 2: resource "opensearch_ism_policy" "log_aws_default" { │ ╵ ╷ │ Error: opensearch version 2.5.0 is older than 6.0.0 and is not supported, flavor: 0. │ │ with opensearch_index_template.log_aws_default[0], │ on index-opensearch.tf line 9, in resource "opensearch_index_template" "log_aws_default": │ 9: resource "opensearch_index_template" "log_aws_default" {

cristianpirtea commented 1 year ago

@komgritz - i specified the version using below format and it worked:

provider "opensearch" {

url = "https://${aws_opensearch_domain.osdomain.endpoint}" sign_aws_requests = true healthcheck = false opensearch_version = "OpenSearch_2.5"

}

rishabh6788 commented 1 year ago

@komgritz OS 2.x is still not fully supported, we have a PR open to add support. @prudhvigodithi

maidanskyi commented 1 year ago

Hi, @rishabh6788, any updates on the PR mentioned above?

@komgritz caught this issue because the documentation doesn't clearly describe how to specify the OpenSearch version. I caught the same error specifying:

provider "opensearch" {
  url                = var.opensearch_url
  username           = var.dash_master_username
  password           = var.dash_master_password
  healthcheck        = false
  opensearch_version = "2.5.0"
}

But

{
  ...
  opensearch_version = "OpenSearch_2.5"
}

works fine.

Pls, provide a more detailed description of all module variables.

moritzzimmer commented 1 year ago

We get a similar error using 2.0.0-beta.1 against a AWS OpenSearch 2.7.0 cluster:

Error: opensearch version OpenSearch_2.7 is older than 1.0.0 and is not supported, flavor: 0.

Provider config:

provider "opensearch" {
  aws_region         = data.aws_region.current.name
  healthcheck        = false
  opensearch_version = "OpenSearch_2.7"
  url                = "https://${module.logs.proxy_url}"
}

Ping response:

{
    "name": "foo",
    "cluster_name": "bar",
    "cluster_uuid": "baz",
    "version": {
        "distribution": "opensearch",
        "number": "2.7.0",
        "build_type": "tar",
        "build_hash": "unknown",
        "build_date": "some-date",
        "build_snapshot": false,
        "lucene_version": "9.5.0",
        "minimum_wire_compatibility_version": "7.10.0",
        "minimum_index_compatibility_version": "7.0.0"
    },
    "tagline": "The OpenSearch Project: https://opensearch.org/"
}
ravi4theja commented 1 year ago

@moritzzimmer We're having the same problem with the exact versions. Did you find any resolution to this? Did anyone else figure out the issue behind the version incompatibility?

moritzzimmer commented 1 year ago

@ravi4theja it seems like you could leave out the opensearch_version in the provider config. In this case, the provider tries to configure itself internally using the OpenSearch response from the ping endpoint.

For us this leads to downstream problems like https://github.com/opensearch-project/terraform-provider-opensearch/issues/69

olexade commented 12 months ago

@moritzzimmer Check your Terraform state. Review the resources and remove deprecated from the state like aws_elasticsearch_domain, elasticsearch_opensearch_user, elasticsearch_opensearch_roles_mapping, etc. Import the resources aws_opensearch_domain, opensearch_user, opensearch_roles_mapping, etc.

fcuza commented 9 months ago

Hey folks if you come across this problem and even with the given solution you still have some issues make sure the iam user/role your are using have the correct permission for it : "es:DescribeDomain*"

moritzzimmer commented 9 months ago

update: we currently have no problems using this provider (2.1.0) against an AWS OpenSearch 2.11 with this provider config:

provider "opensearch" {
  aws_region  = var.region
  healthcheck = false
  url         = "https://${some.output}"
}
DenisBY commented 8 months ago

I have the same issue with On-Premise OS 2.11.1:

opensearch version OpenSearch_2.11 is older than 1.0.0 and is not supported, flavor: 0.
jclavoie22 commented 6 months ago

It seems like the version is only correctly parsed for Serverless OpenSearch. . Regular OS will enter the first condition, flavor is not set and then it fails in the sink here

necoras commented 5 months ago

@jclavoie22 Agreed. Is there any way to hack a flavor in there to make it accept non-serverless installs?

We had a cluster get destroyed and can't finish rebuilding it because we can't create indexes, users, etc. At this point it looks like we might have to fork this just to rip this bad check out.