terraform-provider-gitlab icon indicating copy to clipboard operation
terraform-provider-gitlab copied to clipboard

Add invite resource

Open monotek opened this issue 4 years ago • 0 comments
trafficstars

As gitlab.com does not allow to to create users directly because of missing admin rights it would be nice if it would at least possible to invite users via terraform to groups and / or projects.

Currently i use the following workaound in tf 0.14.4 with local-exec and curl to use the invite api but having a real resource would be more nice.

data "sops_file" "secrets" {
  source_file = "secrets.yaml"
}

resource "null_resource" "invite-tesusers" {
  for_each = toset(module.user-groups.testusers-group)
  provisioner "local-exec" {
    command = "curl -s --request POST --header 'PRIVATE-TOKEN: ${data.sops_file.secrets.data.gitlab_token}' --data 'email=${each.value}&access_level=10' 'https://gitlab.com/api/v4/groups/${var.group_id}/invitations'"
  }
}

monotek avatar Jan 15 '21 14:01 monotek