Skip to content

Commit f6a2651

Browse files
authored
Merge branch 'gitlabhq:main' into main
2 parents c394b13 + b3732f9 commit f6a2651

File tree

62 files changed

+1000
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1000
-467
lines changed

docs/data-sources/repository_file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ data "gitlab_repository_file" "example" {
4343
- `content` (String) File content. If the content is not yet base64 encoded, it will be encoded automatically. No other encoding is currently supported, because of a [GitLab API bug](https://gitlab.com/gitlab-org/gitlab/-/issues/342430).
4444
- `content_sha256` (String) File content sha256 digest.
4545
- `encoding` (String) The file content encoding.
46+
- `execute_filemode` (Boolean) Enables or disables the execute flag on the file. **Note**: requires GitLab 14.10 or newer.
4647
- `file_name` (String) The filename.
4748
- `last_commit_id` (String) The last known commit id.
4849
- `size` (Number) The file size.

docs/data-sources/user.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ data "gitlab_user" "example-two" {
3838

3939
- `email` (String) The public email address of the user. **Note**: before GitLab 14.8 the lookup was based on the users primary email address.
4040
- `id` (String) The ID of this resource.
41+
- `namespace_id` (Number) The ID of the user's namespace. Requires admin token to access this field. Available since GitLab 14.10.
4142
- `user_id` (Number) The ID of the user.
4243
- `username` (String) The username of the user.
4344

docs/data-sources/users.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Read-Only:
7474
- `linkedin` (String)
7575
- `location` (String)
7676
- `name` (String)
77+
- `namespace_id` (Number)
7778
- `organization` (String)
7879
- `projects_limit` (Number)
7980
- `provider` (String)

docs/resources/deploy_key.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ resource "gitlab_deploy_key" "example" {
3737

3838
### Optional
3939

40-
- `can_push` (Boolean) Allow this deploy key to be used to push changes to the project. Defaults to `false`. **NOTE::** this cannot currently be managed.
40+
- `can_push` (Boolean) Allow this deploy key to be used to push changes to the project. Defaults to `false`.
4141
- `id` (String) The ID of this resource.
4242

4343
## Import
@@ -46,5 +46,8 @@ Import is supported using the following syntax:
4646

4747
```shell
4848
# GitLab deploy keys can be imported using an id made up of `{project_id}:{deploy_key_id}`, e.g.
49+
# `project_id` can be whatever the [get single project api][get_single_project] takes for
50+
# its `:id` value, so for example:
4951
terraform import gitlab_deploy_key.test 1:3
52+
terraform import gitlab_deploy_key.test richardc/example:3
5053
```

docs/resources/deploy_key_enable.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ resource "gitlab_deploy_key_enable" "foo" {
5050

5151
### Optional
5252

53-
- `can_push` (Boolean) Can deploy key push to the projects repository.
53+
- `can_push` (Boolean) Can deploy key push to the project's repository.
5454
- `id` (String) The ID of this resource.
5555
- `key` (String) Deploy key.
5656
- `title` (String) Deploy key's title.
@@ -61,5 +61,8 @@ Import is supported using the following syntax:
6161

6262
```shell
6363
# GitLab enabled deploy keys can be imported using an id made up of `{project_id}:{deploy_key_id}`, e.g.
64+
# `project_id` can be whatever the [get single project api][get_single_project] takes for
65+
# its `:id` value, so for example:
6466
terraform import gitlab_deploy_key_enable.example 12345:67890
67+
terraform import gitlab_deploy_key_enable.example richardc/example:67890
6568
```

docs/resources/instance_variable.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ page_title: "gitlab_instance_variable Resource - terraform-provider-gitlab"
44
subcategory: ""
55
description: |-
66
The gitlab_instance_variable resource allows to manage the lifecycle of an instance-level CI/CD variable.
7-
Upstream API: GitLab REST API docs https://docs.gitlab.com/ee/api/instance_level_variables.html
7+
Upstream API: GitLab REST API docs https://docs.gitlab.com/ee/api/instance_level_ci_variables.html
88
---
99

1010
# gitlab_instance_variable (Resource)
1111

1212
The `gitlab_instance_variable` resource allows to manage the lifecycle of an instance-level CI/CD variable.
1313

14-
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/instance_level_variables.html)
14+
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/instance_level_ci_variables.html)
1515

1616
## Example Usage
1717

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "gitlab_personal_access_token Resource - terraform-provider-gitlab"
4+
subcategory: ""
5+
description: |-
6+
The gitlab_personal_access_token resource allows to manage the lifecycle of a personal access token for a specified user.
7+
-> This resource requires administration privileges.
8+
Upstream API: GitLab REST API docs https://docs.gitlab.com/ee/api/personal_access_tokens.html
9+
---
10+
11+
# gitlab_personal_access_token (Resource)
12+
13+
The `gitlab_personal_access_token` resource allows to manage the lifecycle of a personal access token for a specified user.
14+
15+
-> This resource requires administration privileges.
16+
17+
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/personal_access_tokens.html)
18+
19+
## Example Usage
20+
21+
```terraform
22+
resource "gitlab_personal_access_token" "example" {
23+
user_id = "25"
24+
name = "Example personal access token"
25+
expires_at = "2020-03-14"
26+
27+
scopes = ["api"]
28+
}
29+
30+
resource "gitlab_project_variable" "example" {
31+
project = gitlab_project.example.id
32+
key = "pat"
33+
value = gitlab_personal_access_token.example.token
34+
}
35+
```
36+
37+
<!-- schema generated by tfplugindocs -->
38+
## Schema
39+
40+
### Required
41+
42+
- `name` (String) The name of the personal access token.
43+
- `scopes` (Set of String) The scope for the personal access token. It determines the actions which can be performed when authenticating with this token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `sudo`.
44+
- `user_id` (Number) The id of the user.
45+
46+
### Optional
47+
48+
- `expires_at` (String) The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD. Default is never.
49+
- `id` (String) The ID of this resource.
50+
51+
### Read-Only
52+
53+
- `active` (Boolean) True if the token is active.
54+
- `created_at` (String) Time the token has been created, RFC3339 format.
55+
- `revoked` (Boolean) True if the token is revoked.
56+
- `token` (String, Sensitive) The personal access token. This is only populated when creating a new personal access token. This attribute is not available for imported resources.
57+
58+
## Import
59+
60+
Import is supported using the following syntax:
61+
62+
```shell
63+
# A GitLab Personal Access Token can be imported using a key composed of `<user-id>:<token-id>`, e.g.
64+
terraform import gitlab_personal_access_token.example "12345:1"
65+
66+
# NOTE: the `token` resource attribute is not available for imported resources as this information cannot be read from the GitLab API.
67+
```

docs/resources/pipeline_trigger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "gitlab_pipeline_trigger" "example" {
3636

3737
### Read-Only
3838

39-
- `token` (String) The pipeline trigger token.
39+
- `token` (String, Sensitive) The pipeline trigger token.
4040

4141
## Import
4242

docs/resources/project.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ subcategory: ""
55
description: |-
66
The gitlab_project resource allows to manage the lifecycle of a project.
77
A project can either be created in a group or user namespace.
8+
-> Default Branch Protection Workaround Projects are created with default branch protection.
9+
Since this default branch protection is not currently managed via Terraform, to workaround this limitation,
10+
you can remove the default branch protection via the API and create your desired Terraform managed branch protection.
11+
In the gitlab_project resource, define a local-exec provisioner which invokes
12+
the /projects/:id/protected_branches/:name API via curl to delete the branch protection on the default
13+
branch using a DELETE request. Then define the desired branch protection using the gitlab_branch_protection resource.
814
Upstream API: GitLab REST API docs https://docs.gitlab.com/ce/api/projects.html
915
---
1016

@@ -14,6 +20,13 @@ The `gitlab_project` resource allows to manage the lifecycle of a project.
1420

1521
A project can either be created in a group or user namespace.
1622

23+
-> **Default Branch Protection Workaround** Projects are created with default branch protection.
24+
Since this default branch protection is not currently managed via Terraform, to workaround this limitation,
25+
you can remove the default branch protection via the API and create your desired Terraform managed branch protection.
26+
In the `gitlab_project` resource, define a `local-exec` provisioner which invokes
27+
the `/projects/:id/protected_branches/:name` API via curl to delete the branch protection on the default
28+
branch using a `DELETE` request. Then define the desired branch protection using the `gitlab_branch_protection` resource.
29+
1730
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ce/api/projects.html)
1831

1932
## Example Usage
@@ -37,6 +50,17 @@ resource "gitlab_project" "example-two" {
3750
prevent_secrets = true
3851
}
3952
}
53+
54+
# Create a project for a given user (requires admin access)
55+
data "gitlab_user" "peter_parker" {
56+
username = "peter_parker"
57+
}
58+
59+
resource "gitlab_project" "peters_repo" {
60+
name = "peters-repo"
61+
description = "This is a description"
62+
namespace_id = data.gitlab_user.peter_parker.namespace_id
63+
}
4064
```
4165

4266
<!-- schema generated by tfplugindocs -->

docs/resources/repository_file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ resource "gitlab_repository_file" "readme" {
7575

7676
- `author_email` (String) Email of the commit author.
7777
- `author_name` (String) Name of the commit author.
78+
- `execute_filemode` (Boolean) Enables or disables the execute flag on the file. **Note**: requires GitLab 14.10 or newer.
7879
- `id` (String) The ID of this resource.
7980
- `start_branch` (String) Name of the branch to start the new commit from.
8081
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

0 commit comments

Comments
 (0)