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

Creation Release resource and data source

Open Moon1706 opened this issue 2 years ago • 2 comments

Feature Description

I wanna develop Release resource and data source. For this, I should create Milestone and Release links.

Do you want to implement this?

  • [X] I would like to implement this myself 👷

Moon1706 avatar Apr 20 '22 07:04 Moon1706

Hi @timofurrer ! I need advice from your side. I'll wanna develop Release resource, but I've hit with an interesting problem. In official API documentation a release contains Milestones, but official Golang API not. That's not a trouble, just a fact. But, but as you can see Milestone in GitLab API also contains field issue_stats and it's super strange value, because we can't get it from Milestone API and we'll must calculate it. Also, we can't just use a list of Milestone structure in Golang API and have to develop a new structure with this field. As a result, the more I think about in the more I'm sure that we should skip this field. So, what do you think about it?

Moon1706 avatar Jun 28 '22 12:06 Moon1706

@Moon1706 thanks for the detailed questions and the links, super helpful!

I suggest to do the following:

  • Implement the Milestones field in the go-gitlab API.
    • as documented with all the fields from here
    • You don't need to calculate the issue_stats field - they just come here form the API - I don't see the need to involve the Milestones API at all.
  • Implement the milestones attribute in the release resource as a list of strings of milestone titles
    • Thus, you only consume the .Miletones[].Title field from the go-gitlab Release struct for the milestones provider attribute

The resource in terms of the milestones attribute could like something like this:

resource "gitlab_project_release" "this" {
  milestones = ["v1.0", "first-iteration"]
}

WDYT?

timofurrer avatar Jun 30 '22 09:06 timofurrer