terraform-community-providers / terraform-provider-linear

Terraform provider for linear.app
https://registry.terraform.io/providers/terraform-community-providers/linear/latest/docs
Mozilla Public License 2.0
2 stars 1 forks source link

Not possible to define a label with the same name but different parents #21

Closed petemounce closed 1 year ago

petemounce commented 1 year ago

Hi - thanks for creating the provider! I tried to create a label with the same name inside 2 different parents, and got an unexpected error. I reported it within Linear-customers' slack and Brian told me this should be possible (pt2).

(in 0.2.4)

│ Error: Duplicate resource "linear_workspace_label" configuration
│
│   on labels_type.tf line 79:
│   79: resource "linear_workspace_label" "impact_severity_4" {
│
│ A linear_workspace_label resource named "impact_severity_4" was already declared at labels_impact.tf:32,1-54. Resource names must be unique per type in each module.

Repro:

resource "linear_workspace_label" "area" {
  name = "area"
}

resource "linear_workspace_label" "area_docs" {
  name = "docs"
  parent_id = linear_workspace_label.area.id
}

resource "linear_workspace_label" "type" {
  name        = "type"
}

resource "linear_workspace_label" "type_docs" {
  name        = "docs"
  parent_id = linear_workspace_label.type.id
}
pksunkara commented 1 year ago
  1. I don't have access to that Slack, so I cannot see what they are saying.
  2. I don't do anything else other than calling the API directly (here and here)
  3. And I ran into this issue too. IIRC Linear didn't allow me to have labels with the same name even if they were in different parents.

That said, can you please copy and paste what they said? I will also double-check it later today to make sure my API call is not doing anything weird.

petemounce commented 1 year ago

Oh, sorry! Sure, here's the thread [1]. Brian and Davinia work at Linear; it's definitely not currently possible :(

Linear slack thread [1] Peter Mounce [6 days ago](https://linearcustomers.slack.com/archives/CMG738S81/p1682769173535609) I'm creating (nested) labels via the terraform provider 0.2.4. I get an error that I have duplicate label-names. For example: ```hcl resource "linear_workspace_label" "area" { name = "area" color = "#999950" description = "area" } resource "linear_workspace_label" "area_docs" { name = "docs" color = "#999950" description = "area" parent_id = linear_workspace_label.area.id } resource "linear_workspace_label" "type" { name = "type" description = "What type of issue?" color = "#008f39" } resource "linear_workspace_label" "type_docs" { name = "docs" description = "(tf) Documentation ONLY changes." parent_id = linear_workspace_label.type.id color = "#008f39" } ``` I'd thought (hoped) that I could create arbitrarily nested labels (like an S3 / GCS bucket; / separated) I could create a label with the same leaf-name in a different tree (e.g. type/docs & area/docs would be legal) (edited) 6 replies Brian [3 days ago](https://linearcustomers.slack.com/archives/CMG738S81/p1683063559439979?thread_ts=1682769173.535609&cid=CMG738S81) That would be nice indeed, even though Linear only supports one level of depth. That should work But without diving into the actual implementation of the provider, it’s hard to tell. This looks like something that should be reported to the maintainer of the provider at https://github.com/terraform-community-providers/terraform-provider-linear/issues Peter Mounce [2 days ago](https://linearcustomers.slack.com/archives/CMG738S81/p1683106141395619?thread_ts=1682769173.535609&cid=CMG738S81) Oh - does Linear not maintain the provider? Peter Mounce [2 days ago](https://linearcustomers.slack.com/archives/CMG738S81/p1683106218119609?thread_ts=1682769173.535609&cid=CMG738S81) (2) definitely does not work in v0.2.4: │ Error: Duplicate resource "linear_workspace_label" configuration │ │ on labels_type.tf line 79: │ 79: resource "linear_workspace_label" "impact_severity_4" { │ │ A linear_workspace_label resource named "impact_severity_4" was already declared at labels_impact.tf:32,1-54. Resource names must be unique per type in each module. I'll file it. Peter Mounce [2 days ago](https://linearcustomers.slack.com/archives/CMG738S81/p1683106561021969?thread_ts=1682769173.535609&cid=CMG738S81) re: arbitrary-depth - we use this for area/..., so we can understand which product-areas are receiving which issues. I expect us to start to auto-label PRs based on diff-within-monorepo soonish; once we do we can start to have observability over actual-work-happening (vs issues being work-we-plan-to-happen). we can spot PRs that cross area-boundaries, and that will allow us to make decisions within code-reviews (or sooner!) around cross-ownership boundaries. Davina Baker :linear: [1 day ago](https://linearcustomers.slack.com/archives/CMG738S81/p1683193125155099?thread_ts=1682769173.535609&cid=CMG738S81) For number 2 [@Peter Mounce](https://linearcustomers.slack.com/team/U0554PQCKQD) , we were thinking you wanted to create a label called type/docs and then a separate label called area/docs. If you are instead looking to create a label group in Linear called type and then a label group called docs and then a label in each of these called docs, you’re correct that this isn’t currently possible. There can only be one label with the same name, even across multiple label groups. I’ve filed a feature request with your feedback around this though so if we ever make changes here, I’ll let you know. Peter Mounce [1 day ago](https://linearcustomers.slack.com/archives/CMG738S81/p1683193216083969?thread_ts=1682769173.535609&cid=CMG738S81) Thanks for responding; yes, I want to create 2 labels with the same name but different parents. :pray: 1
pksunkara commented 1 year ago

we were thinking you wanted to create a label called type/docs and then a separate label called area/docs. If you are instead looking to create a label group in Linear called type and then a label group called docs and then a label in each of these called docs, you’re correct that this isn’t currently possible. There can only be one label with the same name, even across multiple label groups. I’ve filed a feature request with your feedback around this though so if we ever make changes here, I’ll let you know.

Yup, according to them, this is a limitation in their API. Once they fix it on their side, It will automatically work in the provider since I don't need to change anything.

Therefore, I am closing this. Please feel free to re-open it if this doesn't work after Linear implements support for it.

For now, I would recommend labeling "area: docs" and "type: docs".

petemounce commented 1 year ago

Thanks!