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

Imported ec_deployment resource displays incorrect version #614

Closed
4 tasks done
f1nzer opened this issue Mar 31, 2023 · 2 comments · Fixed by #623
Closed
4 tasks done

Imported ec_deployment resource displays incorrect version #614

f1nzer opened this issue Mar 31, 2023 · 2 comments · Fixed by #623
Labels
bug Something isn't working

Comments

@f1nzer
Copy link

f1nzer commented Mar 31, 2023

Readiness Checklist

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I am reporting the issue to the correct repository (for multi-repository projects)

Expected Behavior

terraform state import imports a correct version of ec_deployment

Current Behavior

The version it imports is incorrect: it displays 8.4.3, instead of 8.7.0
image

Context

I had an ec_deployment of version 8.4.3.
I've updated my cluster manually to version 8.7.0 using elastic cloud dashboard.
Now I'm trying to import terraform state using latest ec provider (0.6.0).

I've tried to update it to 8.7.0 by changing my tf configuration (my expectation was that it will be a no-op):

resource "ec_deployment" "main" {
...
  version                = "8.7.0"

terraform plan partial output:

~ version                = "8.4.3" -> "8.7.0"

Unfortunately, terraform apply command throws exception:

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to ec_deployment.main, provider
│ "provider[\"registry.terraform.io/elastic/ec\"]" produced an unexpected new
│ value: .version: was cty.StringVal("8.7.0"), but now
│ cty.StringVal("8.4.3").
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

Your Environment

  • Version used: 0.6.0
  • Running against Elastic Cloud
  • Terraform: 1.4.2
  • Operating System and version: Windows 10
@f1nzer f1nzer added the bug Something isn't working label Mar 31, 2023
@f1nzer
Copy link
Author

f1nzer commented Mar 31, 2023

Ok, I figured out what was the problem.

According to ElasticCloud API (/deployments/deploymentId) I had Enterprise Search of version 8.4.3, while all other resources are 8.7.0.

Many months ago, I had an Enterprise Search that was disabled (removed).
For some reason, it was not updated with other resources on the recent update to 8.7.0 - it is ok, because it was disabled/removed.

There is a part of response from /deployments endpoint:

"enterprise_search": [
  "status": "stopped",
  "plan_info": {
    "current": {
        "plan": {
            "enterprise_search": {
                "version": "8.4.3"
            }
        }
    }
}

But, it looks like tf ec provider ignores the fact that it was removed and probably uses the minimal version from all resources. Probably this logic validates a wrong field?

My fix was to re-enable Enterprise Search (it automatically triggers an update to 8.7.0) and after that ec provider works as expected.

@xdave
Copy link

xdave commented Apr 15, 2023

I had this same issue while trying to upgrade from 8.6.2 to 8.7.0. At one point, I had Enterprise Search enabled, but it never got upgraded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants