hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.17k forks source link

Elasticsearch domain (opensearch): ValidationException for instance type #27684

Open jim5252 opened 2 years ago

jim5252 commented 2 years ago

Terraform Core Version

1.0.0

AWS Provider Version

4.12.0

Affected Resource(s)

aws_elasticsearch_domain

Expected Behavior

Create a cluster with instance type of t3.medium.search

Actual Behavior

Error: error creating Elasticsearch Domain (opensearch): ValidationException: 1 validation error detected: Value 't3.medium.search' at 'elasticsearchClusterConfig.instanceType' failed to satisfy constraint: Member must satisfy enum value set: [m6i.xlarge.elasticsearch, r6i.16xlarge.elasticsearch, r6gd.12xlarge.elasticsearch, i3.2xlarge.elasticsearch, ultrawarm1.xlarge.elasticsearch, m5.4xlarge.elasticsearch, i4i.32xlarge.elasticsearch, m6i.12xlarge.elasticsearch, r6i.8xlarge.elasticsearch, r6i.large.elasticsearch, t3.xlarge.elasticsearch, i4i.xlarge.elasticsearch, r6a.32xlarge.elasticsearch, m6g.xlarge.elasticsearch, i3.4xlarge.elasticsearch, m3.large.elasticsearch, r6a.xlarge.elasticsearch, m7g.xlarge.elasticsearch, m6g.12xlarge.elasticsearch, r7g.16xlarge.elasticsearch, r4.16xlarge.elasticsearch, t2.micro.elasticsearch, m4.large.elasticsearch, r6a.12xlarge.elasticsearch, c6a.2xlarge.elasticsearch, m6i.48xlarge.elasticsearch, r6gd.16xlarge.elasticsearch, m7g.12xlarge.elasticsearch, d2.2xlarge.elasticsearch, t3.micro.elasticsearch, m5.8xlarge.elasticsearch, m5.large.elasticsearch, r6a.24xlarge.elasticsearch, m6i.16xlarge.elasticsearch, c6a.4xlarge.elasticsearch, i3.8xlarge.elasticsearch, i3.large.elasticsearch, d2.4xlarge.elasticsearch, t2.small.elasticsearch, i4i.16xlarge.elasticsearch, m6a.32xlarge.elasticsearch, c4.2xlarge.elasticsearch, t3.small.elasticsearch, m6a.xlarge.elasticsearch, r6a.16xlarge.elasticsearch, m7g.16xlarge.elasticsearch, c5.2xlarge.elasticsearch, t4i.medium.elasticsearch, m6a.12xlarge.elasticsearch, c6i.32xlarge.elasticsearch, c7g.2xlarge.elasticsearch, c4.4xlarge.elasticsearch, c6a.8xlarge.elasticsearch, c6a.large.elasticsearch, c6i.xlarge.elasticsearch, c6g.2xlarge.elasticsearch, d2.8xlarge.elasticsearch, c5.4xlarge.elasticsearch, c6i.12xlarge.elasticsearch, t4g.medium.elasticsearch, c7g.4xlarge.elasticsearch, m6a.48xlarge.elasticsearch, c6i.24xlarge.elasticsearch, c6i.2xlarge.elasticsearch, c6g.4xlarge.elasticsearch, c6g.xlarge.elasticsearch, m3.medium.elasticsearch, m6a.16xlarge.elasticsearch, c7g.xlarge.elasticsearch, c6g.12xlarge.elasticsearch, c4.8xlarge.elasticsearch, c4.large.elasticsearch, m6a.2xlarge.elasticsearch, c6i.4xlarge.elasticsearch, c7g.12xlarge.elasticsearch, c5.xlarge.elasticsearch, c5.large.elasticsearch, c6i.16xlarge.elasticsearch, t4g.small.elasticsearch, c7g.8xlarge.elasticsearch, c7g.large.elasticsearch, c4.xlarge.elasticsearch, c5.9xlarge.elasticsearch, m6a.4xlarge.elasticsearch, c6g.8xlarge.elasticsearch, c6g.large.elasticsearch, c6a.32xlarge.elasticsearch, c6a.xlarge.elasticsearch, c6i.8xlarge.elasticsearch, c6i.large.elasticsearch, c7g.16xlarge.elasticsearch, d2.xlarge.elasticsearch, ultrawarm1.medium.elasticsearch, t3.nano.elasticsearch, r6a.2xlarge.elasticsearch, c6a.12xlarge.elasticsearch, m7g.2xlarge.elasticsearch, t3.medium.elasticsearch, i4i.2xlarge.elasticsearch, m6a.8xlarge.elasticsearch, m6a.large.elasticsearch, m6g.2xlarge.elasticsearch, t2.medium.elasticsearch, r6a.4xlarge.elasticsearch, m7g.4xlarge.elasticsearch, t3.2xlarge.elasticsearch, c5.18xlarge.elasticsearch, i4i.4xlarge.elasticsearch, c6a.48xlarge.elasticsearch, m6i.2xlarge.elasticsearch, m6g.4xlarge.elasticsearch, i3.xlarge.elasticsearch, c6a.16xlarge.elasticsearch, r6gd.2xlarge.elasticsearch, i2.xlarge.elasticsearch, r3.2xlarge.elasticsearch, m6i.4xlarge.elasticsearch, r7g.2xlarge.elasticsearch, r4.2xlarge.elasticsearch, m5.xlarge.elasticsearch, m4.10xlarge.elasticsearch, r6a.8xlarge.elasticsearch, r6a.large.elasticsearch, r6gd.4xlarge.elasticsearch, m7g.8xlarge.elasticsearch, m7g.large.elasticsearch, r6g.2xlarge.elasticsearch, r3.4xlarge.elasticsearch, r5.2xlarge.elasticsearch, m5.12xlarge.elasticsearch, m4.xlarge.elasticsearch, i4i.8xlarge.elasticsearch, i4i.large.elasticsearch, r6i.32xlarge.elasticsearch, m6g.8xlarge.elasticsearch, m6g.large.elasticsearch, r7g.4xlarge.elasticsearch, r4.4xlarge.elasticsearch, m5.24xlarge.elasticsearch, m3.xlarge.elasticsearch, r6i.2xlarge.elasticsearch, r6i.xlarge.elasticsearch, r6g.4xlarge.elasticsearch, i3.16xlarge.elasticsearch, t3.large.elasticsearch, r5.4xlarge.elasticsearch, m6i.8xlarge.elasticsearch, m6i.large.elasticsearch, r6i.12xlarge.elasticsearch, ultrawarm1.large.elasticsearch, m3.2xlarge.elasticsearch, r6i.24xlarge.elasticsearch, r6i.4xlarge.elasticsearch, r6gd.8xlarge.elasticsearch, r6gd.large.elasticsearch, r6g.xlarge.elasticsearch, r3.8xlarge.elasticsearch, r3.large.elasticsearch, r5.xlarge.elasticsearch, m4.2xlarge.elasticsearch, r7g.8xlarge.elasticsearch, r7g.xlarge.elasticsearch, r7g.large.elasticsearch, r6g.12xlarge.elasticsearch, r4.8xlarge.elasticsearch, r4.xlarge.elasticsearch, r4.large.elasticsearch, r5.12xlarge.elasticsearch, m5.2xlarge.elasticsearch, m6i.32xlarge.elasticsearch, r6gd.xlarge.elasticsearch, r7g.12xlarge.elasticsearch, r6g.8xlarge.elasticsearch, r6g.large.elasticsearch, i2.2xlarge.elasticsearch, r3.xlarge.elasticsearch, r5.24xlarge.elasticsearch, r5.8xlarge.elasticsearch, r5.large.elasticsearch, m4.4xlarge.elasticsearch]

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 4.12.0"...
- Finding latest version of hashicorp/http...
- Finding phillbaker/elasticsearch versions matching ">= 2.0.0, 2.0.0"...
- Installing hashicorp/aws v4.38.0...
- Installed hashicorp/aws v4.38.0 (signed by HashiCorp)
- Installing hashicorp/http v3.2.1...
- Installed hashicorp/http v3.2.1 (signed by HashiCorp)
- Installing phillbaker/elasticsearch v2.0.0...
- Installed phillbaker/elasticsearch v2.0.0

Steps to Reproduce

  1. set instance type of t3.medium.search
  2. terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

This was said to be fixed in https://github.com/hashicorp/terraform-provider-aws/issues/21787 with provider v4.9.0

Provider in my example is configured to 4.12.0

Have also tried with latest provider version and experiencing the same issue.

References

https://github.com/hashicorp/terraform-provider-aws/issues/21787

Would you like to implement a fix?

No response

github-actions[bot] commented 2 years ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 2 years ago

Hey @jim5252 👋 It looks like the way that the issue that you linked was resolved was by introducing a separate resource for OpenSearch -- aws_opensearch_domain. I believe you'll need to use that resource rather than aws_elasticsearch_domain for OpenSearch.

jim5252 commented 2 years ago

Hi @ justinretzolk , thank you for pointing this out. I have changed this configuration. Testing further, I wanted to use an instance type without EBS storage and used r6gd.large.search. However this returns a further error: Error: Error creating OpenSearch domain: InvalidTypeException: Invalid instance type: r6gd.large.search

jim5252 commented 2 years ago

I can confirm that this is working with t3.medium.search and EBS options set

justinretzolk commented 2 years ago

Hey @jim5252 👋 Just to confirm, are you saying you've got it working at this point, or that it works with t3.medium.search, but does not work with r6gd.large.search?

jantman commented 1 year ago

Just FWIW, with terraform 1.2.9 and hashicorp/aws v4.52.0, the validation list appears out of date or otherwise incorrect.

Initially, with a bad instance type, I get:

Error: creating Elasticsearch Domain (mydomain): ValidationException: 1 validation error detected: Value 't3.medium.search' at 'elasticsearchClusterConfig.instanceType' failed to satisfy constraint: Member must satisfy enum value set: [m6i.xlarge.elasticsearch, r6i.16xlarge.elasticsearch, r6gd.12xlarge.elasticsearch, i3.2xlarge.elasticsearch, ultrawarm1.xlarge.elasticsearch, m5.4xlarge.elasticsearch, i4i.32xlarge.elasticsearch, m6i.12xlarge.elasticsearch, r6i.8xlarge.elasticsearch, r6i.large.elasticsearch, t3.xlarge.elasticsearch, i4i.xlarge.elasticsearch, r6a.32xlarge.elasticsearch, m6g.xlarge.elasticsearch, i3.4xlarge.elasticsearch, m3.large.elasticsearch, r6a.xlarge.elasticsearch, m7g.xlarge.elasticsearch, m6g.12xlarge.elasticsearch, r7g.16xlarge.elasticsearch, r4.16xlarge.elasticsearch, t2.micro.elasticsearch, m4.large.elasticsearch, r6a.12xlarge.elasticsearch, c6a.2xlarge.elasticsearch, m6i.48xlarge.elasticsearch, r6gd.16xlarge.elasticsearch, m7g.12xlarge.elasticsearch, d2.2xlarge.elasticsearch, t3.micro.elasticsearch, m5.8xlarge.elasticsearch, m5.large.elasticsearch, r6a.24xlarge.elasticsearch, m6i.16xlarge.elasticsearch, c6a.4xlarge.elasticsearch, i3.8xlarge.elasticsearch, i3.large.elasticsearch, d2.4xlarge.elasticsearch, t2.small.elasticsearch, i4i.16xlarge.elasticsearch, m6a.32xlarge.elasticsearch, c4.2xlarge.elasticsearch, t3.small.elasticsearch, m6a.xlarge.elasticsearch, r6a.16xlarge.elasticsearch, m7g.16xlarge.elasticsearch, c5.2xlarge.elasticsearch, im4gn.xlarge.elasticsearch, t4i.medium.elasticsearch, m6a.12xlarge.elasticsearch, c6i.32xlarge.elasticsearch, c7g.2xlarge.elasticsearch, c4.4xlarge.elasticsearch, c6a.8xlarge.elasticsearch, c6a.large.elasticsearch, c6i.xlarge.elasticsearch, c6g.2xlarge.elasticsearch, d2.8xlarge.elasticsearch, c5.4xlarge.elasticsearch, c6i.12xlarge.elasticsearch, t4g.medium.elasticsearch, c7g.4xlarge.elasticsearch, m6a.48xlarge.elasticsearch, c6i.24xlarge.elasticsearch, c6i.2xlarge.elasticsearch, c6g.4xlarge.elasticsearch, c6g.xlarge.elasticsearch, m3.medium.elasticsearch, im4gn.2xlarge.elasticsearch, m6a.16xlarge.elasticsearch, c7g.xlarge.elasticsearch, c6g.12xlarge.elasticsearch, c4.8xlarge.elasticsearch, c4.large.elasticsearch, im4gn.16xlarge.elasticsearch, m6a.2xlarge.elasticsearch, c6i.4xlarge.elasticsearch, c7g.12xlarge.elasticsearch, c5.xlarge.elasticsearch, c5.large.elasticsearch, im4gn.4xlarge.elasticsearch, c6i.16xlarge.elasticsearch, t4g.small.elasticsearch, c7g.8xlarge.elasticsearch, c7g.large.elasticsearch, r6g.medium.elasticsearch, c4.xlarge.elasticsearch, c5.9xlarge.elasticsearch, m6a.4xlarge.elasticsearch, c6g.8xlarge.elasticsearch, c6g.large.elasticsearch, c6a.32xlarge.elasticsearch, c6a.xlarge.elasticsearch, c6i.8xlarge.elasticsearch, c6i.large.elasticsearch, c7g.16xlarge.elasticsearch, d2.xlarge.elasticsearch, ultrawarm1.medium.elasticsearch, t3.nano.elasticsearch, im4gn.8xlarge.elasticsearch, im4gn.large.elasticsearch, r6a.2xlarge.elasticsearch, c6a.12xlarge.elasticsearch, m7g.2xlarge.elasticsearch, t3.medium.elasticsearch, i4i.2xlarge.elasticsearch, m6a.8xlarge.elasticsearch, m6a.large.elasticsearch, m6g.2xlarge.elasticsearch, m6g.medium.elasticsearch, t2.medium.elasticsearch, r6a.4xlarge.elasticsearch, m7g.4xlarge.elasticsearch, t3.2xlarge.elasticsearch, c5.18xlarge.elasticsearch, i4i.4xlarge.elasticsearch, c6a.48xlarge.elasticsearch, m6i.2xlarge.elasticsearch, m6g.4xlarge.elasticsearch, i3.xlarge.elasticsearch, c6a.16xlarge.elasticsearch, r6gd.2xlarge.elasticsearch, i2.xlarge.elasticsearch, r3.2xlarge.elasticsearch, m6i.4xlarge.elasticsearch, r7g.2xlarge.elasticsearch, r4.2xlarge.elasticsearch, m5.xlarge.elasticsearch, m4.10xlarge.elasticsearch, r6a.8xlarge.elasticsearch, r6a.large.elasticsearch, r6gd.4xlarge.elasticsearch, m7g.8xlarge.elasticsearch, m7g.large.elasticsearch, r6g.2xlarge.elasticsearch, r3.4xlarge.elasticsearch, r5.2xlarge.elasticsearch, m5.12xlarge.elasticsearch, m4.xlarge.elasticsearch, i4i.8xlarge.elasticsearch, i4i.large.elasticsearch, r6i.32xlarge.elasticsearch, m6g.8xlarge.elasticsearch, m6g.large.elasticsearch, r7g.4xlarge.elasticsearch, r4.4xlarge.elasticsearch, m5.24xlarge.elasticsearch, m3.xlarge.elasticsearch, r6i.2xlarge.elasticsearch, r6i.xlarge.elasticsearch, r6g.4xlarge.elasticsearch, i3.16xlarge.elasticsearch, t3.large.elasticsearch, r5.4xlarge.elasticsearch, m6i.8xlarge.elasticsearch, m6i.large.elasticsearch, r6i.12xlarge.elasticsearch, ultrawarm1.large.elasticsearch, m3.2xlarge.elasticsearch, r6i.24xlarge.elasticsearch, r6i.4xlarge.elasticsearch, r6gd.8xlarge.elasticsearch, r6gd.large.elasticsearch, r6g.xlarge.elasticsearch, r3.8xlarge.elasticsearch, r3.large.elasticsearch, r5.xlarge.elasticsearch, m4.2xlarge.elasticsearch, r7g.8xlarge.elasticsearch, r7g.xlarge.elasticsearch, r7g.large.elasticsearch, r6g.12xlarge.elasticsearch, r4.8xlarge.elasticsearch, r4.xlarge.elasticsearch, r4.large.elasticsearch, r5.12xlarge.elasticsearch, m5.2xlarge.elasticsearch, m6i.32xlarge.elasticsearch, r6gd.xlarge.elasticsearch, r7g.12xlarge.elasticsearch, r6g.8xlarge.elasticsearch, r6g.large.elasticsearch, i2.2xlarge.elasticsearch, r3.xlarge.elasticsearch, r5.24xlarge.elasticsearch, r5.8xlarge.elasticsearch, r5.large.elasticsearch, m4.4xlarge.elasticsearch] Note that one of the values in that validation list is t4g.medium.elasticsearch

And yet, if I change my code to use that value, it then fails with an API error:

Error: creating Elasticsearch Domain (mydomain): InvalidTypeException: Invalid instance type: t4g.medium.elasticsearch

justinretzolk commented 1 year ago

Hey @jantman 👋 Thanks for the additional information! It looks like that list valid types is coming from the AWS API itself, rather than being a validation error on the provider side. Looking at the enum list in the AWS Go SDK for Elasticsearch, I don't see t4g.medium.elasticsearch as an option. On the other hand, with the aws_opensearch_domain resource (rather than the older aws_elasticsearch_domain resource), looking at the enum that's used on the AWS API side for that resource, it appears that you should be able to use an instance_type of t4g.medium.search without issue.

JeremyPDC commented 1 year ago

+1 We are running into this issue also. If the correct resource is used in instance_type we get an error saying it is not in the list. If the instance_type is set to elasticsearch version we see an error that it is not in the valid list of values.

phene commented 4 months ago

This is definitely still an issue. Instance types for Opensearch should end in .search not .elasticsearch