Skip to content

How to handle cases where GitLab implicitly creates a resource resulting in tf ownership confusion

There has been a discussion in #266 about what to do in the following situation:

resource "gitlab_group" "group" {
}

resource "gitlab_group_membership" "membership" {
  user_id = <ID of the user owning the GITLAB_TOKEN>
}

... in which GitLab implicitly adds group membership to the gitlab_goup.group for the user owning the token which was used to create the group. This leads to a group membership already exists error for the gitlab_group_membership.membership resource.

The following questions need to be answered:

  • Is this behavior a bug in the gitlab terraform provider?
  • If yes, how should the gitlab_group_membership resource behave?
Edited by Timo Furrer