-
Notifications
You must be signed in to change notification settings - Fork 111
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
Handling services that Consul has deregistered #146
Comments
Hi @randomswdev, can you run |
We use a Consul provider built from the master branch because we need some features/fixes that have been included in the master branch but are not available in version v2.5.0.
We built the provider about a week or two ago, using the source code avialble at that time in the master branch. |
I just tried with master (64de0bb) and it seems to work:
Did I miss something to reproduce the issue? We used to have a bug like this but it's supposed to have been solved in 194fff3. |
I provided an example that was too simple 😄 I finally produced the issue using the following fragment of terraform:
If you deregister one node and issue again the terraform command, terraform will complain that it is not able to refresh the service. The difference here is that the same service is defined on two nodes: if you delete a node, the service still exists, but no longer exists on the deleted node and I think this somehow confuses the provider. |
Yes, this is a mistake. Could you confirm that #147 fixes the issue for you? |
The fix worked for me. Thank you very much @remilapeyre |
Thanks for the info :) |
Terraform Version
0.12
Affected Resource(s)
consul_service
Terraform Configuration Files
Error Output
Actual Behavior
If the service goes into the critical state, Consul deregisters it after the interval defined in
deregister_critical_service_after
. If this happens, when running again terraform, it outputs an error because the service is defined in the state but cannot be refreshed from Consul (it no longer exists).Proposal
I would like to discuss options to avoid the error condition, for example by removing the service from the state in case the refresh fails. This behavior can be applied always or, for example, can be controlled through a switch at the resource or provider level. I don't know if there is any other design alternative; any of them is welcome.
If we can agree on a solution for the issue, I can implement and contribute the patch.
The text was updated successfully, but these errors were encountered: