Skip to content

Commit 093e394

Browse files
authored
Merge pull request #38 from richardc/rc-improve-group-import
Fix and document importing groups
2 parents 3ac5a0c + d8b5159 commit 093e394

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

gitlab/resource_gitlab_group.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func resourceGitlabGroupRead(d *schema.ResourceData, meta interface{}) error {
109109
return err
110110
}
111111

112+
d.SetId(fmt.Sprintf("%d", group.ID))
112113
d.Set("name", group.Name)
113114
d.Set("path", group.Path)
114115
d.Set("description", group.Description)

website/docs/r/group.html.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@ The resource exports the following attributes:
5656

5757
* `id` - The unique id assigned to the group by the GitLab server. Serves as a
5858
namespace id where one is needed.
59+
60+
## Importing groups
61+
62+
You can import a group state using `terraform import <resource> <id>`. The
63+
`id` can be whatever the [details of a group](details_of_a_group) api takes for
64+
its `:id` value, so for example:
65+
66+
terraform import gitlab_group.example example
67+
68+
[details_of_a_group]: https://docs.gitlab.com/ee/api/groups.html#details-of-a-group

0 commit comments

Comments
 (0)