|
| 1 | +--- |
| 2 | +layout: "gitlab" |
| 3 | +page_title: "GitLab: gitlab_project_cluster" |
| 4 | +sidebar_current: "docs-gitlab-resource-project_cluster" |
| 5 | +description: |- |
| 6 | + Creates and manages project clusters for GitLab projects |
| 7 | +--- |
| 8 | + |
| 9 | +# gitlab\_project\_cluster |
| 10 | + |
| 11 | +This resource allows you to create and manage project clusters for your GitLab projects. |
| 12 | +For further information on clusters, consult the [gitlab |
| 13 | +documentation](https://docs.gitlab.com/ce/user/project/clusters/index.html). |
| 14 | + |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```hcl |
| 19 | +resource "gitlab_project" "foo" { |
| 20 | + name = "foo-project" |
| 21 | +} |
| 22 | +
|
| 23 | +resource gitlab_project_cluster "bar" { |
| 24 | + project = "${gitlab_project.foo.id}" |
| 25 | + name = "bar-cluster" |
| 26 | + enabled = true |
| 27 | + kubernetes_api_url = "https://124.124.124" |
| 28 | + kubernetes_token = "some-token" |
| 29 | + kubernetes_ca_cert = "some-cert" |
| 30 | + kubernetes_namespace = "namespace" |
| 31 | + kubernetes_authorization_type = "rbac" |
| 32 | + environment_scope = "*" |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +## Argument Reference |
| 37 | + |
| 38 | +The following arguments are supported: |
| 39 | + |
| 40 | +* `project` - (Required, string) The id of the project to add the cluster to. |
| 41 | + |
| 42 | +* `name` - (Required, string) The name of cluster. |
| 43 | + |
| 44 | +* `enabled` - (Optional, boolean) Determines if cluster is active or not. Defaults to `true`. |
| 45 | + |
| 46 | +* `kubernetes_api_url` - (Required, string) The URL to access the Kubernetes API. |
| 47 | + |
| 48 | +* `kubernetes_token` - (Required, string) The token to authenticate against Kubernetes. |
| 49 | + |
| 50 | +* `kubernetes_ca_cert` - (Optional, string) TLS certificate (needed if API is using a self-signed TLS certificate). |
| 51 | + |
| 52 | +* `kubernetes_namespace` - (Optional, string) The unique namespace related to the project. |
| 53 | + |
| 54 | +* `kubernetes_authorization_type` - (Optional, string) The cluster authorization type. Valid values are `rbac`, `abac`, `unknown_authorization`. Defaults to `rbac`. |
| 55 | + |
| 56 | +* `environment_scope` - (Optional, string) The associated environment to the cluster. Defaults to `*`. |
| 57 | + |
| 58 | +## Import |
| 59 | + |
| 60 | +GitLab project clusters can be imported using an id made up of `projectid:clusterid`, e.g. |
| 61 | + |
| 62 | +``` |
| 63 | +$ terraform import gitlab_project_cluster.bar 123:321 |
| 64 | +``` |
0 commit comments