terraform-provider-gitlab icon indicating copy to clipboard operation
terraform-provider-gitlab copied to clipboard

Group sub-groups, descendent groups, and projects, data sources

Open MrMickS opened this issue 2 years ago • 4 comments

Feature Description

We would like to do some traversing of Gitlab sub-groups with Terraform. In order to be able to do this we would like to see gitlab_group_subgroups, gitlab_group_descendent, and gitlab_group_projects calls added to the provider.

API calls are available for these and they would allow us to manage other resources associated with the Gitlab groups.

Do you want to implement this?

  • [ ] I would like to implement this myself 👷

MrMickS avatar Jul 18 '22 13:07 MrMickS

@MrMickS

API calls are available

I assume that you are looking for data sources:

  • gitlab_group_subgroups -> https://docs.gitlab.com/ee/api/groups.html#list-a-groups-subgroups
  • gitlab_group_descendent -> https://docs.gitlab.com/ee/api/groups.html#list-a-groups-descendant-groups

Can you be a little bit more specific what gitlab_group_project should be?

Maybe this already helps for the gitlab_group_project:

  • You can create projects in a group using the namespace_id attribute in the gitlab_project resource.
  • You can create groups inside another group using, again, the [namespace_id](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/group#:~:text=parent_id%20(Number)%20Id%20of%20the%20parent%20group%20(creates%20a%20nested%20group).
  • You can have a data source for projects in a group by using a combination of gitlab_group and gitlab_projects data sources

timofurrer avatar Jul 18 '22 13:07 timofurrer

I meant to put gitlab_group_projects. What I'm looking for there is:

  • gitlab_group_projects -> https://docs.gitlab.com/ee/api/groups.html#list-a-groups-projects

They are all one-to-one mappings to a Gitlab API call.

MrMickS avatar Jul 18 '22 13:07 MrMickS

Would the mechanisms from the example here solve the gitlab_group_projects use case?

timofurrer avatar Jul 18 '22 13:07 timofurrer

Yes. Thanks, I didn't see that one.

MrMickS avatar Jul 19 '22 06:07 MrMickS