Treat 404 as success when deleting gitlab_branch_protection

When a gitlab_branch_protection resource is replaced (destroy-then-create, e.g. because it was tainted), the destroy step can fail if the branch protection has already been removed server-side, aborting the whole apply:

Error: Failed to delete gitlab branch protection
404 Not Found

Delete now treats a 404 from the unprotect API as an already-deleted resource, removing it from state and succeeding, matching the idiomatic pattern used by other resources in this provider.

Adds a unit test for api.Is404 and an acceptance test that reproduces the tainted-replace-with-out-of-band-deletion scenario.

Edited by Andrew Newdigate

Merge request reports

Loading