gitlab_group (Resource)

The gitlab_group resource allows to manage the lifecycle of a group.

Upstream API: GitLab REST API docs

Example Usage

resource "gitlab_group" "example" {
  name        = "example"
  path        = "example"
  description = "An example group"
}

# Create a project in the example group
resource "gitlab_project" "example" {
  name         = "example"
  description  = "An example project"
  namespace_id = gitlab_group.example.id
}

# Group with custom push rules
resource "gitlab_group" "example-two" {
  name        = "example-two"
  path        = "example-two"
  description = "An example group with push rules"

  push_rules {
    author_email_regex     = "@example\\.com$"
    commit_committer_check = true
    member_check           = true
    prevent_secrets        = true
  }
}

Schema

Required

Optional

Read-Only

Nested Schema for push_rules

Optional:

Import

Import is supported using the following syntax:

# You can import a group state using `terraform import <resource> <id>`.  The
# `id` can be whatever the [details of a group][details_of_a_group] api takes for
# its `:id` value, so for example:
terraform import gitlab_group.example example