- Documentation
- Mailing list: Google Groups
- Build status:
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.14+ is required).
-
Clone the git repository.
$ git clone git@github.com:gitlabhq/terraform-provider-gitlab $ cd terraform-provider-gitlab
-
Build the provider with
make build
. This will build the provider and put the provider binary in the$GOPATH/bin
directory.$ make build
The acceptance tests can run against a Gitlab instance where you have a token with administrator permissions (likely not gitlab.com).
This option is the easiest and requires docker-compose (version 1.13+) to be installed on your machine.
- Start the Gitlab container. It will take about 5 minutes for the container to become healthy.
$ make testacc-up
- Run the acceptance tests. The full suite takes 10-20 minutes to run.
$ make testacc
- Stop the Gitlab container.
$ make testacc-down
If you have your own hosted Gitlab instance, you can run the tests against it directly.
$ make testacc GITLAB_TOKEN=example123 GITLAB_BASE_URL=https://example.com/api/v4
GITLAB_TOKEN
must be a valid token for an account with admin privileges.
-
Gitlab Community Edition and Gitlab Enterprise 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
andisRunningInCE
. You can see an example of this for gitlab_project_level_mr_approvals tests. -
Run EE tests:
If you have a
Gitlab-license.txt
you can run Gitlab EE, which will enable the full suite of tests:$ make testacc-up SERVICE=gitlab-ee
-
Run a single test:
You can pass a pattern to the
RUN
variable to run a reduced number of tests. For example:$ make testacc RUN=TestAccGitlabGroup
...will run all tests for the
gitlab_group
resource. -
Debug a test in an IDE:
First start the Gitlab container with
make testacc-up
. Then run the desired Go test as you would normally from your IDE, but configure your run configuration to set these environment variables:GITLAB_TOKEN=ACCTEST1234567890123 GITLAB_BASE_URL=http://127.0.0.1:8080/api/v4 TF_ACC=1
-
Useful HashiCorp documentation:
Refer to HashiCorp's testing guide and HashiCorp's testing best practices.