Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch domain: ValidationException for instance type #21787

Closed
nirsv opened this issue Nov 16, 2021 · 14 comments · Fixed by #23902
Closed

Elasticsearch domain: ValidationException for instance type #21787

nirsv opened this issue Nov 16, 2021 · 14 comments · Fixed by #23902
Assignees
Labels
bug Addresses a defect in current functionality. service/elasticsearch Issues and PRs that pertain to the elasticsearch service.
Milestone

Comments

@nirsv
Copy link

nirsv commented Nov 16, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Affected Resource(s)

  • aws_elasticsearch_domain

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

Create a cluster with instance type of i3.2xlarge.search (which is the type when you manually create an amazon opensearch cluster)

Actual Behavior

When I choose instance type of type i3.2xlarge.search (which is the type when you manually create an amazon opensearch cluster) I get the following error:
rror creating Elasticsearch domain: ValidationException: 2 validation errors detected: Value 'i3.2xlarge.search' at 'elasticsearchClusterConfig.instanceType' failed to satisfy constraint: Member must satisfy enum value set: [r6gd.12xlarge.elasticsearch, i3.2xlarge.elasticsearch, ultrawarm1.xlarge.elasticsearch, m5.4xlarge.elasticsearch, t3.xlarge.elasticsearch, m6g.xlarge.elasticsearch, i3.4xlarge.elasticsearch, m3.large.elasticsearch, m6g.12xlarge.elasticsearch, r4.16xlarge.elasticsearch, t2.micro.elasticsearch, m4.large.elasticsearch, r6gd.16xlarge.elasticsearch, d2.2xlarge.elasticsearch, t3.micro.elasticsearch, m5.large.elasticsearch, i3.8xlarge.elasticsearch, i3.large.elasticsearch, d2.4xlarge.elasticsearch, t2.small.elasticsearch, c4.2xlarge.elasticsearch, t3.small.elasticsearch, c5.2xlarge.elasticsearch, c4.4xlarge.elasticsearch, c6g.2xlarge.elasticsearch, d2.8xlarge.elasticsearch, c5.4xlarge.elasticsearch, t4g.medium.elasticsearch, c6g.4xlarge.elasticsearch, c6g.xlarge.elasticsearch, m3.medium.elasticsearch, c6g.12xlarge.elasticsearch, c4.8xlarge.elasticsearch, c4.large.elasticsearch, c5.xlarge.elasticsearch, c5.large.elasticsearch, t4g.small.elasticsearch, c4.xlarge.elasticsearch, c5.9xlarge.elasticsearch, c6g.8xlarge.elasticsearch, c6g.large.elasticsearch, d2.xlarge.elasticsearch, ultrawarm1.medium.elasticsearch, t3.nano.elasticsearch, t3.medium.elasticsearch, m6g.2xlarge.elasticsearch, t2.medium.elasticsearch, t3.2xlarge.elasticsearch, c5.18xlarge.elasticsearch, m6g.4xlarge.elasticsearch, i3.xlarge.elasticsearch, r6gd.2xlarge.elasticsearch, i2.xlarge.elasticsearch, r3.2xlarge.elasticsearch, r4.2xlarge.elasticsearch, m5.xlarge.elasticsearch, m4.10xlarge.elasticsearch, r6gd.4xlarge.elasticsearch, r6g.2xlarge.elasticsearch, r3.4xlarge.elasticsearch, r5.2xlarge.elasticsearch, m5.12xlarge.elasticsearch, m4.xlarge.elasticsearch, m6g.8xlarge.elasticsearch, m6g.large.elasticsearch, r4.4xlarge.elasticsearch, m5.24xlarge.elasticsearch, m3.xlarge.elasticsearch, r6g.4xlarge.elasticsearch, i3.16xlarge.elasticsearch, t3.large.elasticsearch, r5.4xlarge.elasticsearch, ultrawarm1.large.elasticsearch, m3.2xlarge.elasticsearch, r6gd.8xlarge.elasticsearch, r6gd.large.elasticsearch, r6g.xlarge.elasticsearch, r3.8xlarge.elasticsearch, r3.large.elasticsearch, r5.xlarge.elasticsearch, m4.2xlarge.elasticsearch, r6g.12xlarge.elasticsearch, r4.8xlarge.elasticsearch, r4.xlarge.elasticsearch, r4.large.elasticsearch, r5.12xlarge.elasticsearch, m5.2xlarge.elasticsearch, r6gd.xlarge.elasticsearch, r6g.8xlarge.elasticsearch, r6g.large.elasticsearch, i2.2xlarge.elasticsearch, r3.xlarge.elasticsearch, r5.24xlarge.elasticsearch, r5.large.elasticsearch, m4.4xlarge.elasticsearch]; Value 'm5.large.search' at 'elasticsearchClusterConfig.dedicatedMasterType' failed to satisfy constraint: Member must satisfy enum value set: [r6gd.12xlarge.elasticsearch, i3.2xlarge.elasticsearch, ultrawarm1.xlarge.elasticsearch, m5.4xlarge.elasticsearch, t3.xlarge.elasticsearch, m6g.xlarge.elasticsearch, i3.4xlarge.elasticsearch, m3.large.elasticsearch, m6g.12xlarge.elasticsearch, r4.16xlarge.elasticsearch, t2.micro.elasticsearch, m4.large.elasticsearch, r6gd.16xlarge.elasticsearch, d2.2xlarge.elasticsearch, t3.micro.elasticsearch, m5.large.elasticsearch, i3.8xlarge.elasticsearch, i3.large.elasticsearch, d2.4xlarge.elasticsearch, t2.small.elasticsearch, c4.2xlarge.elasticsearch, t3.small.elasticsearch, c5.2xlarge.elasticsearch, c4.4xlarge.elasticsearch, c6g.2xlarge.elasticsearch, d2.8xlarge.elasticsearch, c5.4xlarge.elasticsearch, t4g.medium.elasticsearch, c6g.4xlarge.elasticsearch, c6g.xlarge.elasticsearch, m3.medium.elasticsearch, c6g.12xlarge.elasticsearch, c4.8xlarge.elasticsearch, c4.large.elasticsearch, c5.xlarge.elasticsearch, c5.large.elasticsearch, t4g.small.elasticsearch, c4.xlarge.elasticsearch, c5.9xlarge.elasticsearch, c6g.8xlarge.elasticsearch, c6g.large.elasticsearch, d2.xlarge.elasticsearch, ultrawarm1.medium.elasticsearch, t3.nano.elasticsearch, t3.medium.elasticsearch, m6g.2xlarge.elasticsearch, t2.medium.elasticsearch, t3.2xlarge.elasticsearch, c5.18xlarge.elasticsearch, m6g.4xlarge.elasticsearch, i3.xlarge.elasticsearch, r6gd.2xlarge.elasticsearch, i2.xlarge.elasticsearch, r3.2xlarge.elasticsearch, r4.2xlarge.elasticsearch, m5.xlarge.elasticsearch, m4.10xlarge.elasticsearch, r6gd.4xlarge.elasticsearch, r6g.2xlarge.elasticsearch, r3.4xlarge.elasticsearch, r5.2xlarge.elasticsearch, m5.12xlarge.elasticsearch, m4.xlarge.elasticsearch, m6g.8xlarge.elasticsearch, m6g.large.elasticsearch, r4.4xlarge.elasticsearch, m5.24xlarge.elasticsearch, m3.xlarge.elasticsearch, r6g.4xlarge.elasticsearch, i3.16xlarge.elasticsearch, t3.large.elasticsearch, r5.4xlarge.elasticsearch, ultrawarm1.large.elasticsearch, m3.2xlarge.elasticsearch, r6gd.8xlarge.elasticsearch, r6gd.large.elasticsearch, r6g.xlarge.elasticsearch, r3.8xlarge.elasticsearch, r3.large.elasticsearch, r5.xlarge.elasticsearch, m4.2xlarge.elasticsearch, r6g.12xlarge.elasticsearch, r4.8xlarge.elasticsearch, r4.xlarge.elasticsearch, r4.large.elasticsearch, r5.12xlarge.elasticsearch, m5.2xlarge.elasticsearch, r6gd.xlarge.elasticsearch, r6g.8xlarge.elasticsearch, r6g.large.elasticsearch, i2.2xlarge.elasticsearch, r3.xlarge.elasticsearch, r5.24xlarge.elasticsearch, r5.large.elasticsearch, m4.4xlarge.elasticsearch]

Steps to Reproduce

  1. set instance type of i3.2xlarge.search
  2. terraform apply

Important Factoids

The enum should include the type i3.2xlarge.search rather than i3.2xlarge.elasticsearch

References

  • #0000
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/elasticsearch Issues and PRs that pertain to the elasticsearch service. labels Nov 16, 2021
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 17, 2021
@ivoros
Copy link

ivoros commented Nov 23, 2021

The same goes to t3.medium.search. Terraform is clearly not prepared for OpenSearch yet.

Error: Error creating Elasticsearch domain: ValidationException: 1 validation error detected: Value 't3.medium.search' at 'elasticsearchClusterConfig.instanceType' failed to satisfy constraint: Member must satisfy enum value set: ....

@tonymayflower
Copy link

please, can we have update on the issue please ?

@ghdiska
Copy link
Contributor

ghdiska commented Jan 4, 2022

opensearch is a separate service in aws-sdk-go ( service opensearchservice ) but terraform use elastictsearch service only

@nirsv
Copy link
Author

nirsv commented Jan 4, 2022

AWS managed sercice is only opensearch.
Terraform must support it.
Yiu cannot use aws_elasticsearch_domain without actually create opensearch domain

@snazzyfox
Copy link

Even though opensearch has separate APIs and shows up as a separate service in the SDK, it is a full replacement of elasticsearch. The existing elasticsearch APIs appear to simply translate requests to opensearch instead.

  • Using a new instance type name (e.g. m6g.large.search) causes an error in terraform as shown in the issue.
  • Using an old instance type name (e.g. m6g.large.elasticsearch) passes terraform's validation, but the SDK throws InvalidTypeException: Invalid instance type: m6g.large.elasticsearch since it's expecting the new instance type names instead.

This completely breaks the aws_elasticsearch_domain resource in terraform as it's impossible to create new domains or update any existing domains (created before aws's rebranding).

@raffek
Copy link

raffek commented Jan 24, 2022

Is there any update on this? Any workaround recommendation?

@hannes-ucsc
Copy link

hannes-ucsc commented Jan 24, 2022

I could swear the old .elasticsearch types worked four days ago. As of today they stopped working. I get

InvalidTypeException: Invalid instance type: r6gd.xlarge.elasticsearch

during terraform apply. plan and validate pass.

$ terraform version
Terraform v0.12.24
+ provider.aws v2.70.0
+ provider.google v2.20.3
+ provider.null v2.1.2
+ provider.template v2.2.0

@hannes-ucsc
Copy link

hannes-ucsc commented Jan 26, 2022

It turns out that creating a domain with cluster_config.instance_type set to an .elasticsearch type still works if the elasticsearch_version is set to 7.10. Updating an existing domain whose elasticsearch_version is 6.8 fails, even if the update attempts to set elasticsearch_version to 7.10 while also setting cluster_config.instance_type to say r6gd.xlarge.elasticsearch. Updating cluster_config.instance_type on an existing domain whose elasticsearch_version is 7.10 also works.

This might just be a bug in AWS.

@sobi3ch
Copy link

sobi3ch commented Mar 3, 2022

It turns out that creating a domain with cluster_config.instance_type set to an .elasticsearch type still works if the elasticsearch_version is set to 7.10. Updating an existing domain whose elasticsearch_version is 6.8 fails, even if the update attempts to set elasticsearch_version to 7.10 while also setting cluster_config.instance_type to say r6gd.xlarge.elasticsearch. Updating cluster_config.instance_type on an existing domain whose elasticsearch_version is 7.10 also works.

This might just be a bug in AWS.

Confirming, with version 7.10 it works (accidentally has set to 7.1) and extension must be *.elasticsearch.

@zatr
Copy link

zatr commented Mar 7, 2022

It turns out that creating a domain with cluster_config.instance_type set to an .elasticsearch type still works if the elasticsearch_version is set to 7.10. Updating an existing domain whose elasticsearch_version is 6.8 fails, even if the update attempts to set elasticsearch_version to 7.10 while also setting cluster_config.instance_type to say r6gd.xlarge.elasticsearch. Updating cluster_config.instance_type on an existing domain whose elasticsearch_version is 7.10 also works.

This might just be a bug in AWS.

This is a workaround using an old version of Elasticsearch. This issue was submitted because Terraform cannot be used to create an OpenSearch domain.

@hannes-ucsc
Copy link

I'm not contending the motivation for this issue. The AWS provider is a client to AWS, so the inability of the client to perform an operation could be caused by a bug in the server i.e. AWS.

@mattburgess
Copy link
Collaborator

See also #20853 - there's a PR open at #23902 that introduces the aws_opensearch_* resources necessary to support OpenSearch domains, which are what the .search suffixed instance types relate to. Unfortunately, due to the way AWS added support for OpenSearch in their API, there isn't an easy way to avoid some migration headaches with the switchover that I can see.

I think it may be a case of:

  1. API/AWS console/AWS CLI call to initiate the version upgrade outside of TF's knowledge
  2. terraform state mv and/or terraform import of various resources to align with the aws_opensearch_* resource types

@github-actions
Copy link

github-actions bot commented Apr 7, 2022

This functionality has been released in v4.9.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented May 8, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticsearch Issues and PRs that pertain to the elasticsearch service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.