Skip to content

nishant-jain-94/terraform-gitlab-organization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

terraform-gitlab-organization

A Terraform Module to Provision Gitlab Resources on Gitlab Instance

πŸš€ Features

πŸ’ Usage

Add Users

Add Users Details

main.tf

variable "gitlab_token" {
  type = "string"
}

variable "base_url" {
  type = "string"
}

variable "users" {
  default = {}
}

module "add_users" {
  source       = "../../"
  gitlab_token = var.gitlab_token
  base_url     = var.base_url
  users        = var.users
}

users.auto.tfvars.json

{
  "users": {
    "aditya.singh@northwind.in": {
      "username": "aditya.singh",
      "email": "aditya.singh@northwind.in",
      "password": "password@123",
      "groups_access": {},
      "projects_access": {}
    },
    "raj.singh@northwind.in": {
      "username": "raj.singh",
      "email": "raj.singh@northwind.in",
      "password": "password@123",
      "groups_access": {},
      "projects_access": {}
    }
  }
}

Add Groups

Add Groups

main.tf

variable "gitlab_token" {
  type = "string"
}

variable "base_url" {
  type = "string"
}

variable groups {
  default = {}
}

module "add_groups" {
  source       = "../../"
  gitlab_token = var.gitlab_token
  base_url     = var.base_url
  groups       = var.groups
}

groups.auto.tfvars.json

{
  "groups": {
    "northwind-wave-2": {
      "group_name": "northwind-wave-2",
      "group_description": "A Group for entire northwind Wave 1"
    },
    "northwind-mentors-1": {
      "group_name": "northwind-mentors-1",
      "group_description": "Group Created for northwind mentors"
    },
    "northwind-auditors-1": {
      "group_name": "northwind-auditors-1",
      "group_description": "Group Created for auditors"
    }
  }
}

Add Users to Groups

Add Users to Groups

main.tf

variable "gitlab_token" {
  type = "string"
}

variable "base_url" {
  type = "string"
}

variable "users" {
  default = {}
}

variable "groups" {
  default = {}
}

variable "user_namespaces" {
  default = {}
}

variable "group_namespaces" {
  default = {}
}

module "add_groups_users" {
  source           = "../../"
  gitlab_token     = var.gitlab_token
  base_url         = var.base_url
  groups           = var.groups
  users            = var.users
  user_namespaces  = var.user_namespaces
  group_namespaces = var.group_namespaces
}

groups.auto.tfvars.json

{
  "groups": {
    "northwind-wave-2": {
      "group_name": "northwind-wave-2",
      "group_description": "A Group for entire northwind Wave 1"
    },
    "northwind-mentors-1": {
      "group_name": "northwind-mentors-1",
      "group_description": "Group Created for northwind mentors"
    },
    "northwind-auditors-1": {
      "group_name": "northwind-auditors-1",
      "group_description": "Group Created for auditors"
    }
  }
}

users.auto.tfvars.json

{
  "users": {
    "aditya.singh@northwind.in": {
      "username": "aditya.singh",
      "email": "aditya.singh@northwind.in",
      "password": "password@123",
      "groups_access": {},
      "projects_access": {}
    },
    "raj.singh@northwind.in": {
      "username": "raj.singh",
      "email": "raj.singh@northwind.in",
      "password": "password@123",
      "groups_access": {},
      "projects_access": {}
    }
  }
}

namespaces.auto.tfvars.json

{
  "group_namespaces": {
    "northwind-wave-2": {
      "group_name": "northwind-wave-2"
    },
    "northwind-mentors-1": {
      "group_name": "northwind-mentors-1"
    },
    "northwind-auditors-1": {
      "group_name": "northwind-auditors-1"
    }
  },
  "user_namespaces": {
    "aditya.singh": {
      "email": "aditya.singh@northwind.in"
    },
    "raj.singh": {
      "email": "raj.singh@northwind.in"
    },
    "harry.potter": {
      "email": "harry.potter@northwind.in"
    },
    "alice.wonderland": {
      "email": "alice.wonderland@northwind.in"
    }
  }
}

Add Projects to Groups

Add Projects to Groups

main.tf

variable "gitlab_token" {
  type = "string"
}

variable "base_url" {
  type = "string"
}

variable "users" {
  default = {}
}

variable "projects" {
  default = {}
}

variable "groups" {
  default = {}
}

variable "user_namespaces" {
  default = {}
}

variable "group_namespaces" {
  default = {}
}

module "add_users_projects" {
  source           = "../../"
  gitlab_token     = var.gitlab_token
  base_url         = var.base_url
  projects         = var.projects
  groups           = var.groups
  user_namespaces  = var.user_namespaces
  group_namespaces = var.group_namespaces
}

groups.auto.tfvars.json

{
  "groups": {
    "northwind-wave-2": {
      "group_name": "northwind-wave-2",
      "group_description": "A Group for entire northwind Wave 1"
    },
    "northwind-mentors-1": {
      "group_name": "northwind-mentors-1",
      "group_description": "Group Created for northwind mentors"
    },
    "northwind-auditors-1": {
      "group_name": "northwind-auditors-1",
      "group_description": "Group Created for auditors"
    }
  }
}

namespaces.auto.tfvars.json

{
  "group_namespaces": {
    "northwind-wave-2": {
      "group_name":"northwind-wave-2"
    },
    "northwind-mentors-1": {
      "group_name": "northwind-mentors-1"
    },
    "northwind-auditors-1": {
      "group_name": "northwind-auditors-1"
    }
  },
  "user_namespaces": {}
}

projects.auto.tfvars.json

{
  "projects": {
    "mentors-project-1": {
      "name": "mentors-project-1",
      "description": "This is only the Test Project",
      "visibility_level": "private",
      "namespace_id": "northwind-mentors-1",
      "only_allow_merge_if_pipeline_succeeds": false,
      "shared_with_groups": {}
    },
    "users-project-1": {
      "name": "users-project-1",
      "description": "This is only the Test Project",
      "visibility_level": "private",
      "namespace_id": "northwind-auditors-1",
      "only_allow_merge_if_pipeline_succeeds": true,
      "shared_with_groups": {
        "northwind-wave-2": "guest"
      }
    }
  }
}

πŸ“ Contribution Guidelines

Contributions to this Module are very much welcome. Checkout the Contribution Guidelines for instructions.

πŸ”– Changelog

Changelog to this terraform module are logged here on Changelog.

πŸ› Issues

Incase of Issues or Feature requests log it here in the issues section.

πŸ“„ License

This code is release under MIT License. Please see LICENSE for more details.

About

A Terraform Module to Provision Gitlab Resources on Gitlab Instance

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published