Just remove deleted bindings not present in the API.

We can just set the ID of bindings that are scheduled to be deleted but
don't exist in the API, we don't need an entire separate read request.
This commit is contained in:
Paddy 2017-07-25 11:12:15 -07:00
parent d3f901bfc3
commit 9c1c0bbc52

View File

@ -204,7 +204,9 @@ func resourceGoogleProjectIamBindingDelete(d *schema.ResourceData, meta interfac
break
}
if toRemove < 0 {
return resourceGoogleProjectIamBindingRead(d, meta)
log.Printf("[DEBUG]: Policy bindings for project %q did not include a binding for role %q, no need to delete", pid, binding.Role)
d.SetId("")
return nil
}
p.Bindings = append(p.Bindings[:toRemove], p.Bindings[toRemove+1:]...)