Root resource was present, but now absent in terraform?

Team,

We have a custom provider and calling like this for adding members into
a group

resource "custom_azuread_member" "db-writer-users" {
  for_each  = toset(var.db_writers)
  group_id  = custom_azuread_group.dbwriter.id
  object_id = each.value
}

But receiving this error:

Root resource was present, but now absent.

I have read few posts suggesting to wait after each run as a work around. Is there any way to put sleep in every run of for_each loop. Or, would be grateful for any better suggestions on this issue.

Regards,

Hi @smartaquarius10,

I’m not sure since you didn’t share the entire error message, but I think this is an error message where Terraform is reporting incorrect behavior in the part of the provider, rather than incorrect input configuration, in which case the solution would be to fix the provider to properly implement the provider protocol, so that this error message cannot appear.

If you aren’t sure how to interpret the error message then it would help if you could share the full error message and then I’d be happy to try to give a more specific suggestion.

Thank you so much for helping. This is the only error message I’m getting

Error: Provider produced inconsistent result after apply
When applying changes to
 
 module.db-tst-1.custom_azuread_member.db-writer-users["xxx@company.com"],
 
provider "provider[\"pqrs.company.com/company/custom\"]"
 
produced an unexpected new value: Root resource was present, but now absent.