You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This resource allows to manage GitLab user SSH keys.
7
+
Upstream API: GitLab API docs https://docs.gitlab.com/ee/api/users.html#single-ssh-key
8
+
---
9
+
10
+
# gitlab_user_sshkey (Resource)
11
+
12
+
This resource allows to manage GitLab user SSH keys.
13
+
14
+
**Upstream API**: [GitLab API docs](https://docs.gitlab.com/ee/api/users.html#single-ssh-key)
15
+
16
+
## Example Usage
17
+
18
+
```terraform
19
+
data "gitlab_user" "example" {
20
+
username = "example-user"
21
+
}
22
+
23
+
resource "gitlab_user_sshkey" "example" {
24
+
user_id = data.gitlab_user.id
25
+
title = "example-key"
26
+
key = "ssh-rsa AAAA..."
27
+
expires_at = "2016-01-21T00:00:00.000Z"
28
+
}
29
+
```
30
+
31
+
<!-- schema generated by tfplugindocs -->
32
+
## Schema
33
+
34
+
### Required
35
+
36
+
-**key** (String) The ssh key. The SSH key `comment` (trailing part) is optional and ignored for diffing, because GitLab overrides it with the username and GitLab hostname.
37
+
-**title** (String) The title of the ssh key.
38
+
-**user_id** (Number) The ID of the user to add the ssh key to.
39
+
40
+
### Optional
41
+
42
+
-**expires_at** (String) The expiration date of the SSH key in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)
43
+
-**id** (String) The ID of this resource.
44
+
45
+
### Read-Only
46
+
47
+
-**created_at** (String) The time when this key was created in GitLab.
48
+
-**key_id** (Number) The ID of the ssh key.
49
+
50
+
## Import
51
+
52
+
Import is supported using the following syntax:
53
+
54
+
```shell
55
+
# You can import a user ssh key using an id made up of `{user-id}:{key}`, e.g.
Description: "The ID of the user to add the ssh key to.",
33
+
Type: schema.TypeInt,
34
+
ForceNew: true,
35
+
Required: true,
36
+
},
25
37
"title": {
26
38
Description: "The title of the ssh key.",
27
39
Type: schema.TypeString,
40
+
ForceNew: true,
28
41
Required: true,
29
42
},
30
43
"key": {
31
-
Description: "The ssh key.",
44
+
Description: "The ssh key. The SSH key `comment` (trailing part) is optional and ignored for diffing, because GitLab overrides it with the username and GitLab hostname.",
0 commit comments