Skip to content

Commit d27c7be

Browse files
Update docs for v15.7.0 release
1 parent 3db332f commit d27c7be

File tree

9 files changed

+139
-8
lines changed

9 files changed

+139
-8
lines changed

docs/data-sources/metadata.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "gitlab_metadata Data Source - terraform-provider-gitlab"
4+
subcategory: ""
5+
description: |-
6+
The gitlab_metadata data source retrieves the metadata of the GitLab instance.
7+
Upstream API: GitLab REST API docs https://docs.gitlab.com/ee/api/metadata.html
8+
---
9+
10+
# gitlab_metadata (Data Source)
11+
12+
The `gitlab_metadata` data source retrieves the metadata of the GitLab instance.
13+
14+
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/metadata.html)
15+
16+
## Example Usage
17+
18+
```terraform
19+
data "gitlab_metadata" "this" {}
20+
```
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema
24+
25+
### Read-Only
26+
27+
- `enterprise` (Boolean) If the GitLab instance is an enterprise instance or not. Supported for GitLab 15.6 onwards.
28+
- `id` (String) The id of the data source. It will always be `1`
29+
- `kas` (Attributes) Metadata about the GitLab agent server for Kubernetes (KAS). (see [below for nested schema](#nestedatt--kas))
30+
- `revision` (String) Revision of the GitLab instance.
31+
- `version` (String) Version of the GitLab instance.
32+
33+
<a id="nestedatt--kas"></a>
34+
### Nested Schema for `kas`
35+
36+
Read-Only:
37+
38+
- `enabled` (Boolean) Indicates whether KAS is enabled.
39+
- `external_url` (String) URL used by the agents to communicate with KAS. It’s null if kas.enabled is false.
40+
- `version` (String) Version of KAS. It’s null if kas.enabled is false.
41+
42+

docs/data-sources/project.md

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ data "gitlab_project" "example" {
4747
- `build_timeout` (Number) The maximum amount of time, in seconds, that a job can run.
4848
- `builds_access_level` (String) Set the builds access level. Valid values are `disabled`, `private`, `enabled`.
4949
- `ci_config_path` (String) CI config file path for the project.
50+
- `ci_separated_caches` (Boolean) Use separate caches for protected branches.
5051
- `container_expiration_policy` (List of Object) Set the image cleanup policy for this project. **Note**: this field is sometimes named `container_expiration_policy_attributes` in the GitLab Upstream API. (see [below for nested schema](#nestedatt--container_expiration_policy))
5152
- `container_registry_access_level` (String) Set visibility of container registry, for this project. Valid values are `disabled`, `private`, `enabled`.
5253
- `default_branch` (String) The default branch for the project.
@@ -76,6 +77,7 @@ data "gitlab_project" "example" {
7677
- `request_access_enabled` (Boolean) Allow users to request member access.
7778
- `requirements_access_level` (String) Set the requirements access level. Valid values are `disabled`, `private`, `enabled`.
7879
- `resolve_outdated_diff_discussions` (Boolean) Automatically resolve merge request diffs discussions on lines changed with a push.
80+
- `restrict_user_defined_variables` (Boolean) Allow only users with the Maintainer role to pass user-defined variables when triggering a pipeline.
7981
- `runners_token` (String) Registration token to use during runner setup.
8082
- `security_and_compliance_access_level` (String) Set the security and compliance access level. Valid values are `disabled`, `private`, `enabled`.
8183
- `snippets_access_level` (String) Set the snippets access level. Valid values are `disabled`, `private`, `enabled`.

docs/data-sources/projects.md

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Read-Only:
148148
- `request_access_enabled` (Boolean)
149149
- `requirements_access_level` (String)
150150
- `resolve_outdated_diff_discussions` (Boolean)
151+
- `restrict_user_defined_variables` (Boolean)
151152
- `runners_token` (String)
152153
- `security_and_compliance_access_level` (String)
153154
- `shared_runners_enabled` (Boolean)

docs/guides/version-15.7-upgrade.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
page_title: "Terraform GitLab Provider Version 15.7 Upgrade Guide"
3+
---
4+
5+
# Upgrade to Terraform GitLab Provider Version 15.7
6+
7+
Because the GitLab Provider has moved to [GitLab.com](https://gitlab.com/gitlab-org/terraform-provider-gitlab),
8+
the release cadence and versioning has been
9+
[aligned](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/issues/1331) with the GitLab
10+
[monthly self-managed release cadence](https://about.gitlab.com/handbook/engineering/releases/)
11+
starting with 15.7 (22nd Dec 2022).
12+
13+
The version bump from [`3.20.0`](https://registry.terraform.io/providers/gitlabhq/gitlab/3.20.0) to
14+
[`v15.7.0`](https://registry.terraform.io/providers/gitlabhq/gitlab/15.7.0) introduced a few breaking changes,
15+
which are described below.
16+
17+
18+
## Terraform version 1.0
19+
20+
The GitLab Provider upgraded to
21+
[Terraform Protocol v6](https://developer.hashicorp.com/terraform/plugin/how-terraform-works#protocol-version-6),
22+
which **requires at least Terraform 1.0**.
23+
24+
## Provider token is now sensitive
25+
26+
The `token` Provider argument is now marked as
27+
[`sensitive`](https://developer.hashicorp.com/terraform/tutorials/configuration-language/sensitive-variables).
28+
This affects current Provider configurations, which read the `token` value from another non-sensitive Terraform value,
29+
like an output attribute or variable.
30+
31+
Because the `variable "gitlab_token"` declaration doesn't mark the variable as `sensitive`,
32+
code like the following will break:
33+
34+
```hcl
35+
variable "gitlab_token" {
36+
type = string
37+
}
38+
39+
provider "gitlab" {
40+
token = var.gitlab_token
41+
}
42+
```
43+
There are two ways to resolve this issue:
44+
45+
- If you have control over the token value, mark it as
46+
[sensitive](https://developer.hashicorp.com/terraform/language/values/variables#suppressing-values-in-cli-output):
47+
48+
```hcl
49+
variable "gitlab_token" {
50+
type = string
51+
sensitive = true
52+
}
53+
54+
provider "gitlab" {
55+
token = var.gitlab_token
56+
}
57+
```
58+
59+
- If you don't have control over the token value, use the
60+
[`sensitive()`](https://developer.hashicorp.com/terraform/language/functions/sensitive) function to create
61+
a *sensitive* copy of the value to use:
62+
63+
```hcl
64+
provider "gitlab" {
65+
token = sensitive(some_other_module.gitlab_token)
66+
}
67+
```

docs/index.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,12 @@ resource "gitlab_project" "sample_group_project" {
6969
<!-- schema generated by tfplugindocs -->
7070
## Schema
7171

72-
### Required
73-
74-
- `token` (String) The OAuth2 Token, Project, Group, Personal Access Token or CI Job Token used to connect to GitLab. The OAuth method is used in this provider for authentication (using Bearer authorization token). See https://docs.gitlab.com/ee/api/#authentication for details. It may be sourced from the `GITLAB_TOKEN` environment variable.
75-
7672
### Optional
7773

7874
- `base_url` (String) 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/v4/`. It is optional to provide this value and it can also be sourced from the `GITLAB_BASE_URL` environment variable. The value must end with a slash.
7975
- `cacert_file` (String) This is a file containing the ca cert to verify the gitlab instance. This is available for use when working with GitLab CE or Gitlab Enterprise with a locally-issued or self-signed certificate chain.
8076
- `client_cert` (String) File path to client certificate when GitLab instance is behind company proxy. File must contain PEM encoded data.
8177
- `client_key` (String) File path to client key when GitLab instance is behind company proxy. File must contain PEM encoded data. Required when `client_cert` is set.
82-
- `early_auth_check` (Boolean) (Experimental) By default the provider does a dummy request to get the current user in order to verify that the provider configuration is correct and the GitLab API is reachable. Turn it off, to skip this check. This may be useful if the GitLab instance does not yet exist and is created within the same terraform module. This is an experimental feature and may change in the future. Please make sure to always keep backups of your state.
78+
- `early_auth_check` (Boolean) (Experimental) By default the provider does a dummy request to get the current user in order to verify that the provider configuration is correct and the GitLab API is reachable. Set this to `false` to skip this check. This may be useful if the GitLab instance does not yet exist and is created within the same terraform module. This is an experimental feature and may change in the future. Please make sure to always keep backups of your state.
8379
- `insecure` (Boolean) When set to true this disables SSL verification of the connection to the GitLab instance.
80+
- `token` (String, Sensitive) The OAuth2 Token, Project, Group, Personal Access Token or CI Job Token used to connect to GitLab. The OAuth method is used in this provider for authentication (using Bearer authorization token). See https://docs.gitlab.com/ee/api/#authentication for details. It may be sourced from the `GITLAB_TOKEN` environment variable.

docs/resources/group.md

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ resource "gitlab_project" "example" {
4444
### Optional
4545

4646
- `auto_devops_enabled` (Boolean) Defaults to false. Default to Auto DevOps pipeline for all projects within this group.
47+
- `avatar` (String) A local path to the avatar image to upload. **Note**: not available for imported resources.
48+
- `avatar_hash` (String) The hash of the avatar image. Use `filesha256("path/to/avatar.png")` whenever possible. **Note**: this is used to trigger an update of the avatar. If it's not given, but an avatar is given, the avatar will be updated each time.
4749
- `default_branch_protection` (Number) Defaults to 2. See https://docs.gitlab.com/ee/api/groups.html#options-for-default_branch_protection
4850
- `description` (String) The description of the group.
4951
- `emails_disabled` (Boolean) Defaults to false. Disable email notifications.
@@ -64,6 +66,7 @@ resource "gitlab_project" "example" {
6466

6567
### Read-Only
6668

69+
- `avatar_url` (String) The URL of the avatar image.
6770
- `full_name` (String) The full name of the group.
6871
- `full_path` (String) The full path of the group.
6972
- `id` (String) The ID of this resource.

docs/resources/group_project_file_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ resource "gitlab_project" "bar" {
4242
}
4343
4444
resource "gitlab_group_project_file_template" "template_link" {
45-
group_id = gitlab_group.foo.id
46-
project = gitlab_project.bar.id
45+
group_id = gitlab_group.foo.id
46+
file_template_project_id = gitlab_project.bar.id
4747
}
4848
```
4949

docs/resources/project.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,24 @@ resource "gitlab_project" "peters_repo" {
8484
- `auto_devops_deploy_strategy` (String) Auto Deploy strategy. Valid values are `continuous`, `manual`, `timed_incremental`.
8585
- `auto_devops_enabled` (Boolean) Enable Auto DevOps for this project.
8686
- `autoclose_referenced_issues` (Boolean) Set whether auto-closing referenced issues on default branch.
87+
- `avatar` (String) A local path to the avatar image to upload. **Note**: not available for imported resources.
88+
- `avatar_hash` (String) The hash of the avatar image. Use `filesha256("path/to/avatar.png")` whenever possible. **Note**: this is used to trigger an update of the avatar. If it's not given, but an avatar is given, the avatar will be updated each time.
8789
- `build_coverage_regex` (String, Deprecated) Test coverage parsing for the project. This is deprecated feature in GitLab 15.0.
8890
- `build_git_strategy` (String) The Git strategy. Defaults to fetch.
8991
- `build_timeout` (Number) The maximum amount of time, in seconds, that a job can run.
9092
- `builds_access_level` (String) Set the builds access level. Valid values are `disabled`, `private`, `enabled`.
9193
- `ci_config_path` (String) Custom Path to CI config file.
9294
- `ci_default_git_depth` (Number) Default number of revisions for shallow cloning.
9395
- `ci_forward_deployment_enabled` (Boolean) When a new deployment job starts, skip older deployment jobs that are still pending.
96+
- `ci_separated_caches` (Boolean) Use separate caches for protected branches.
9497
- `container_expiration_policy` (Block List, Max: 1) Set the image cleanup policy for this project. **Note**: this field is sometimes named `container_expiration_policy_attributes` in the GitLab Upstream API. (see [below for nested schema](#nestedblock--container_expiration_policy))
9598
- `container_registry_access_level` (String) Set visibility of container registry, for this project. Valid values are `disabled`, `private`, `enabled`.
96-
- `container_registry_enabled` (Boolean) Enable container registry for the project.
99+
- `container_registry_enabled` (Boolean, Deprecated) Enable container registry for the project.
97100
- `default_branch` (String) The default branch for the project.
98101
- `description` (String) A description of the project.
99102
- `emails_disabled` (Boolean) Disable email notifications.
100103
- `external_authorization_classification_label` (String) The classification label for the project.
104+
- `forked_from_project_id` (Number) The id of the project to fork. During create the project is forked and during an update the fork relation is changed.
101105
- `forking_access_level` (String) Set the forking access level. Valid values are `disabled`, `private`, `enabled`.
102106
- `group_with_project_templates_id` (Number) For group-level custom templates, specifies ID of group from which all the custom project templates are sourced. Leave empty for instance-level templates. Requires use_custom_template to be true (enterprise edition).
103107
- `import_url` (String) Git URL to a repository to be imported.
@@ -134,6 +138,7 @@ resource "gitlab_project" "peters_repo" {
134138
- `request_access_enabled` (Boolean) Allow users to request member access.
135139
- `requirements_access_level` (String) Set the requirements access level. Valid values are `disabled`, `private`, `enabled`.
136140
- `resolve_outdated_diff_discussions` (Boolean) Automatically resolve merge request diffs discussions on lines changed with a push.
141+
- `restrict_user_defined_variables` (Boolean) Allow only users with the Maintainer role to pass user-defined variables when triggering a pipeline.
137142
- `security_and_compliance_access_level` (String) Set the security and compliance access level. Valid values are `disabled`, `private`, `enabled`.
138143
- `shared_runners_enabled` (Boolean) Enable shared runners for this project.
139144
- `skip_wait_for_default_branch_protection` (Boolean) If `true`, the default behavior to wait for the default branch protection to be created is skipped.
@@ -156,6 +161,7 @@ This attribute is only used during resource creation, thus changes are suppresse
156161

157162
### Read-Only
158163

164+
- `avatar_url` (String) The URL of the avatar image.
159165
- `http_url_to_repo` (String) URL that can be provided to `git clone` to clone the
160166
- `id` (String) The ID of this resource.
161167
- `path_with_namespace` (String) The path of the repository with namespace.

docs/resources/repository_file.md

+13
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ resource "gitlab_repository_file" "readme" {
5858
author_name = "Terraform"
5959
commit_message = "feature: add readme file"
6060
}
61+
62+
resource "gitlab_repository_file" "readme_for_dogs" {
63+
project = gitlab_project.this.id
64+
file_path = "readme.txt"
65+
branch = "main"
66+
content = "Bark goes the dog"
67+
author_email = "[email protected]"
68+
author_name = "Terraform"
69+
commit_message = "feature: update readme file"
70+
// file will be overwritten if it already exists and added to state
71+
overwrite_on_create = true
72+
}
6173
```
6274

6375
<!-- schema generated by tfplugindocs -->
@@ -76,6 +88,7 @@ resource "gitlab_repository_file" "readme" {
7688
- `author_email` (String) Email of the commit author.
7789
- `author_name` (String) Name of the commit author.
7890
- `execute_filemode` (Boolean) Enables or disables the execute flag on the file. **Note**: requires GitLab 14.10 or newer.
91+
- `overwrite_on_create` (Boolean) Enable overwriting existing files, defaults to `false`. This attribute is only used during `create` and must be use carefully. We suggest to use `imports` whenever possible and limit the use of this attribute for when the project was imported on the same `apply`. This attribute is not supported during a resource import.
7992
- `start_branch` (String) Name of the branch to start the new commit from.
8093
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
8194

0 commit comments

Comments
 (0)