-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Terraform 0.14.6, bad provider configuration resolution #27785
Comments
I also have the same bug if I'm using a submodule from mysql to create user In my mysql module
|
Hi @Poil! Thanks for reporting this. Unfortunately the configuration you wrote here is an example of something that Terraform has never reliably supported and should arguably be outright banned, but we've ended up leaving it in a "best effort" state out of a sense of pragmatism given that, as you've seen, it does sometimes work. However, that "sometimes" is very important: whether it works or not depends a lot on what else is going on in the same plan, and so that's why the Provider Configuration documentation simplifies this to say that this is not allowed at all:
I expect that you saw this working originally due to the intersection of the following two facts:
The problem here is that these assumptions will not hold if anything you do later on causes Resolving this will require introducing a new concept into Terraform to handle the situation where particular resource instances can't be planned at all on a particular run, and must be deferred until some other objects have been created first. One such model is described in the long-standing design proposal #4149, but since it's a significant change to Terraform's execution model, and therefore riddled with risk and unknowns, we've not been able to make any progress on it so far and would need to take the time for more detailed research. In the meantime, I think the best we can do here is to try to determine why upgrading Terraform caused One thing we could try in order to hopefully get some more information here is to try to create a targeted plan that excludes the resource instances belonging to the
My hope is that running the above will cause Terraform to successfully produce a partial plan rather than to fail with the error you saw. If so, it would be helpful if you could share that plan output here so we can see what the provider is proposing to change and hopefully also understand why it's doing that. I'll note also that if you are able to successfully produce a targeted plan then it's likely that you could then apply that plan to escape the error situation you've encountered: the |
Hi, Thanks for your detailed answer. I downgraded my stack to 0.13.6 now if I switch back to 0.14.6 the plan (with and without targeting) it works. Best regards, |
Returning to this old issue a long time later, I realize that I later opened #30937 which covers the same problem this one is describing. Since there's more context over there about what the problem is and how the Terraform team is planning to solve it, I'm going to close this issue to consolidate the discussion there. |
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. |
Hi,
With Terraform 0.14.6, I have a problem when using the mysql provider in a module, it works at first run, but at second run I have this error during the plan stage
Could not connect to server: dial tcp 127.0.0.1:3306: connect: connection refused
With Terraform 0.13.6, I have no problem it works with the same code
Best regards
Terraform Version
Terraform Configuration Files
In my stack
In my module
Steps to Reproduce
terraform init
terraform apply
terraform apply
The text was updated successfully, but these errors were encountered: