I should be able to upgrade my OpenSearch cluster to a new version (in my case from version 2.13 to 2.15) without the package_ids of my aws_opensearch_package_association resources falling out of sync with the AWS environment.
Actual Behavior
When i upgrade my OpenSearch cluster via aws_opensearch_domain then all associated OpenSearch packages will automatically upgrade. This unfortunately changes the package ids of all of my OpenSearch packages in AWS, and as a result the terraform state file (and my terraform code) fall out of sync with the AWS environment (aws_opensearch_package_association resources directly reference the package id). Any subsequent attempt to apply terraform changes to AWS will fail because terraform will attempt to install now incompatible versions of the OpenSearch packages to the cluster.
Furthermore, updating the terraform code with the new package ids and reapplying will not fix the problem. Terraform complains that a package with the same name is already installed on the cluster.
In fact, it seems the only solution is to a) either don't track packages in terraform, or b) remove the old package from the terraform state file, and reimport it from AWS.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Provided on request.
Steps to Reproduce
deploy version 2.13 of OpenSearch using the aws_opensearch_domain resource
associate package_id G263530972 (analysis-stconvert) package with the domain
apply terraform changes to aws
upgrade the opensearch domain to v 2.15 via aws_opensearch_domain
apply terraform changes to aws. At this point you will notice the package id of the analysis-stconvert package will update to G39275358
apply terraform changes to aws again. This time the process will fail because the package_id your aws_opensearch_package_association resource reference will no longer be compatible with the domain.
update the package_id of your aws_opensearch_package_association resource to G39275358
appy terraform changes to aws again. This time the process will fail because a package with the same name is already installed on the cluster.
Debug Output
This error occurs when applying any terraform changes after an OpenSearch upgrade
Error: creating OpenSearch Package Association (redacted): ValidationException: Operation not allowed. Plugin version is not compatible with the engine version running on the domain.
This error occurs when updating your aws_opensearch_package_association resources to the package_id installed on the cluster
Error: creating OpenSearch Package Association (redacted): ValidationException: Operation not allowed. The domain has a plugin installed with the same name.
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.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Terraform Core Version
1.1.9
AWS Provider Version
5.60.0
Affected Resource(s)
aws_opensearch_domain, aws_opensearch_package_association
Expected Behavior
I should be able to upgrade my OpenSearch cluster to a new version (in my case from version 2.13 to 2.15) without the package_ids of my
aws_opensearch_package_association
resources falling out of sync with the AWS environment.Actual Behavior
When i upgrade my OpenSearch cluster via
aws_opensearch_domain
then all associated OpenSearch packages will automatically upgrade. This unfortunately changes the package ids of all of my OpenSearch packages in AWS, and as a result the terraform state file (and my terraform code) fall out of sync with the AWS environment (aws_opensearch_package_association resources directly reference the package id). Any subsequent attempt to apply terraform changes to AWS will fail because terraform will attempt to install now incompatible versions of the OpenSearch packages to the cluster.Furthermore, updating the terraform code with the new package ids and reapplying will not fix the problem. Terraform complains that a package with the same name is already installed on the cluster.
In fact, it seems the only solution is to a) either don't track packages in terraform, or b) remove the old package from the terraform state file, and reimport it from AWS.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Provided on request.
Steps to Reproduce
aws_opensearch_domain
resourceG263530972
(analysis-stconvert) package with the domainaws_opensearch_domain
G39275358
package_id
youraws_opensearch_package_association
resource reference will no longer be compatible with the domain.package_id
of youraws_opensearch_package_association
resource toG39275358
Debug Output
This error occurs when applying any terraform changes after an OpenSearch upgrade
This error occurs when updating your
aws_opensearch_package_association
resources to the package_id installed on the clusterPanic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None