fix: handle 404 gracefully on gitlab_group_membership delete
What does this MR do and why?
Fixes gitlab_group_membership to handle 404 Not Found responses gracefully during delete operations.
When a GitLab user is blocked (e.g. via IT offboarding), their group membership becomes invisible to the API, causing the provider to receive a 404 when Terraform tries to destroy the resource. Previously this surfaced as an error, blocking the entire apply run and requiring manual terraform state rm intervention.
This MR applies the same 404 → remove-from-state pattern already used in:
- The
Readfunction of this same resource gitlab_branch_protectionDelete (!3176 (merged), !3177 (closed))
Changes
resource_gitlab_group_membership.go: Addedapi.Is404(err)check in theDeletefunction — when a 404 is received, the resource is treated as already gone and the destroy succeeds silently.resource_gitlab_group_membership_test.go: AddedTestAccGitlabGroupMembership_deleteOutOfBandacceptance test that removes the membership out-of-band before a Terraform destroy, verifying no 404 error is returned.
MR acceptance checklist
- This MR does not break the documented Terraform Plugin SDK compatibility promises
- Tests added for new functionality
- Existing tests updated if needed
Closes #6853 (closed)