This repository has been archived by the owner on Nov 14, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Probably during the rabbithole update from 7235f3, the errors has currently
checked by the provider don't correctly detect that a resource has gone
missing on the cluster.
This creates unexpected "404 Not Found" errors at the end of any
refresh/plan/apply/destroy if any of the resources previously created by
Terraform (and known in the Terraform state) has been removed from the
RabbitMQ cluster, outside of Terraform.
I only tested a few, but this should affect all the resources: queues,
exchanges, vhost, permissions, users and policies (verified only on
vhosts, permissions, users and policies).
In this case, the RabbitMQ provider tries to read the resource it created
in the past, receives a 404 response from the cluster but doesn't treat it
correctly and returns a generic response "404 Object Not Found".
This change tries to read the error as a rabbithole error and handle the
404 response correctly.
I added a basic test on the "vhost" resource to show that it's working correctly now. What I was trying to do was:
I'm not too familiar with Terraform providers so feel free to suggest an alternative way of doing so.
Also, I've only added a test on the vhost resource but the bug affects most if not all the resources. Let me know it that test looks OK and if you would like me to extend it to other resources as well.