* provider/gitlab: Fix documentation copypasta The original provider and docs were copied from the github provider, one bit of copy paste slipped unmissed. * provider/gitlab: Document `gitlab_project#id` * provider/gitlab: Document `gitlab_project#namespace_id` * provider/gitlab: Add fuller demonstration to the provider page Following in the style of other provider pages, add a worked example showing off all of the available resources offered by the gitlab provider. * provider/gitlab: Correct sample for gitlab_project
2.0 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| gitlab | Provider: GitLab | docs-gitlab-index | The GitLab provider is used to interact with GitLab organization resources. |
GitLab Provider
The GitLab provider is used to interact with GitLab organization resources.
The provider allows you to manage your GitLab organization's members and teams easily. It needs to be configured with the proper credentials before it can be used.
Use the navigation to the left to read about the available resources.
Example Usage
# Configure the GitLab Provider
provider "gitlab" {
token = "${var.gitlab_token}"
}
# Add a project owned by the user
resource "gitlab_project" "sample_project" {
name = "example"
}
# Add a hook to the project
resource "gitlab_project_hook" "sample_project_hook" {
project = "${gitlab_project.sample_project.id}"
url = "https://example.com/project_hook"
}
# Add a deploy key to the project
resource "gitlab_deploy_key" "sample_deploy_key" {
project = "${gitlab_project.sample_project.id}"
title = "terraform example"
key = "ssh-rsa AAAA..."
}
# Add a group
resource "gitlab_group" "sample_group" {
name = "example"
path = "example"
description = "An example group"
}
# Add a project to the group - example/example
resource "gitlab_project" "sample_group_project" {
name = "example"
namespace_id = "${gitlab_group.sample_group.id}"
}
Argument Reference
The following arguments are supported in the provider block:
-
token- (Optional) This is the GitLab personal access token. It must be provided, but it can also be sourced from theGITLAB_TOKENenvironment variable. -
base_url- (Optional) This is the target GitLab base API endpoint. Providing a value is a requirement when working with GitLab CE or GitLab Enterprise e.g. https://my.gitlab.server/api/v3/. It is optional to provide this value and it can also be sourced from theGITLAB_BASE_URLenvironment variable. The value must end with a slash.