Closed gberche-orange closed 6 years ago
The root cause was actually not in orange-cloudfoundry/terraform-provider-cloudfoundry but rather in the the caller TF specs where there was two concurrent cloudfoundry_domain resources targetting the same domain, creating a race condition between them.
I searched in https://github.com/hashicorp/terraform/blob/master/helper/schema/schema.go for a way to make an attribute as a kind of "primary key" in a resource in order to detect collisions, but did not yet find it. May be in terraform issues/requests for enhancement.
Closing for now
We observe the following traces without apparent related TF spec changes
Suspecting that when refreshing the list, the order of orgs (with whom the domain is shared) changes unpredicbily and triggers the equivalent of
cf unshare-private-domain org domain
andcf share-private-domain org domain
As a result, the corresponding existing routes gets deleted silently without warning.
Hopefully, the split between domain and private_domain_access in mevansam/terraform-provider-cf won't allow the same issue to reproduce there.