I need to work around an issue in the MongoDB Atlas provider, which causes certain attributes under
mongodbatlas_cluster not to be available until the cluster is fully operational (the resource is currently marked as created as soon as the creation request is accepted, not when the cluster is actually ready).
The current workaround is to wait a few minutes and then run
terraform refresh (or, in my case, re-apply because other resources depend on the missing attributes).
So I’m hoping to work around this within Terraform to avoid any human intervention, but the only options I’ve found are less than ideal:
time_sleep(or one of its siblings): I’d have to set a really high number to make sure the attributes will be available (if it completed successfully).
local-execto run a script that ends with
exit 0once the cluster is available.
Is there a pure Terraform solution (no
*-exec) that could simply wait until a given condition is met? I use Terraform Cloud in case that’s relevant.
Thanks! And happy new year.