-
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 crashes with deposed resources #18643
Comments
Hi @teu! Thanks for reporting this, and sorry for this unfortunate behavior. I think the issue here is that Terraform expects that the only reasonable operation to do for a deposed instance is to destroy it. I think what it should ideally do is first refresh that instance during plan -- just as it would do for a non-deposed resource -- and then Terraform would get an opportunity to notice that the remote object is already deleted and not plan to delete it. In the mean time, I think the only way to avoid this is to let Terraform be the one to delete the deposed object, rather than some other system. If the object still exists at the point Terraform tries to delete it then it should complete successfully. |
Hi @apparentlymart. The problem is, we have this in our production state and we are quite not sure how to get rid of it without removing infrastructure. I tried removing it with Any idea how to fix the state? |
Hi @teu! I'm sorry I don't have a great answer here, but I do have an idea for a possible workaround:
I will be the first to admit that this is a bothersome workaround because it involves creating a temporary state where Terraform doesn't know about the remote resource at all, and so it'll take some care to ensure that another Terraform run doesn't try to create a fresh one in the mean time. A variant of this is possible if your environment can tolerate there temporarily being another duplicate launch configuration: do steps 1 and 2 from above and then just run |
Hi @apparentlymart, This actually solved my problem. We are very grateful! Cheers |
Hello, I also have this problem. |
@vlad2 works for me here
Then:
|
@apparentlymart You are a life Saver. I wish i can thank you some how. Cheers and thank you |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
In essence terraform complains, if I understand it correctly, about not being able to remove non-existent resource that is a dependency for another non-existent resource.
Terraform Version
v0.11.7
Plan Output
Plan:
Crash:
Expected Behavior
The deferred resource should be removed.
Actual Behavior
Crashes
Steps to Reproduce
This is tricky as it happen after a failed
terraform apply
so I am unsure on how to produce this state.What would be useful is to know the way that terraform calculates the state files checksum. With the ability to update the checksum, removing those deposed resources would be very easy.
The text was updated successfully, but these errors were encountered: