claranet / terraform-provider-gitlab

Terraform GitLab provider

Home Page:https://www.terraform.io/docs/providers/gitlab/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTE: archived repository

This repository is no longer maintained, please use the official and actively supported provider instead. See this Pull Request for more information.


Terraform Provider for Gitlab

Requirements

  • Terraform 0.12.x
  • Go >= 1.14 (to build the provider plugin)

Building The Provider

This is a fork of the official Terraform Provider for Gitlab, with additional changes from Claranet.

Most notably, this fork:

  • includes not yet released changes from the official provider.
  • adds the gitlab_group_members resource.
  • has its master branch on par with the upstream master, with no additional changes.
  • has its default branch set to claranet, which is where custom development happens.

Unofficial tags made by Claranet are suffixed -claranet, and eventually an increment. They are based on the most recent upstream tag name on which the claranet branch was last rebased.

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-gitlab

$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
$ git clone git@github.com:terraform-providers/terraform-provider-gitlab
$ cd terraform-provider-gitlab
$ git remote rename origin upstream
$ git remote add origin git@github.com:claranet/terraform-provider-gitlab

Note: this is done in that order so that master tracks the upstream one.

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-gitlab
$ make build

Rebasing The Provider

$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-gitlab
$ git checkout master
$ git pull
$ git push origin master
$ git checkout claranet
$ git rebase upstream/master

Using the provider

Fill in for each provider

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.14+ is required).

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
...
$ $GOPATH/bin/terraform-provider-gitlab
...

Running tests

The Terraform Provider only has acceptance tests, these can run against a gitlab instance where you have a token with administrator permissions (likely not gitlab.com). There is excellent documentation on how to run gitlab from docker at gitlab.com

In order to run the full suite of acceptance tests, export the environment variables:

  • GITLAB_TOKEN //token for account with admin priviliges
  • GITLAB_BASE_URL //URL with api part e.g. http://localhost:8929/api/v4/

and run make testacc.

$ make testacc

Gitlab Community Edition and Gitlab Entreprise Edition

This module supports both Gitlab CE and Gitlab EE. We run tests on Gitlab EE, but can't run them on pull requests from forks.

Features that only work on one flavour can use the following helpers as SkipFunc: isRunningInEE and isRunningInCE. You can see an exemple of this for gitlab_project_push_rules tests.

About

Terraform GitLab provider

https://www.terraform.io/docs/providers/gitlab/

License:Mozilla Public License 2.0


Languages

Language:Go 97.6%Language:HTML 1.3%Language:Shell 0.7%Language:Makefile 0.4%